Multi-Row Variable Assignment and ORDER BYCommented on: 4 years ago
(February 4, 2010)
These lists are often for a child table, where the covering index is likely to be on the foreign key from the parent table, plus the key for the child entity. But it's good to know that these bloody-...
T-SQL Challenge – Efficient Partitioned TOPCommented on: 5 years ago
(October 2, 2009)
With a smaller number of rows, the CTE solution seems more efficient than this time-proven GROUP BY syntax. Putting the two queries in a batch, the CTE takes up around 36%.
select t1.grp, t1.col1,...
Catch That Bug! Random Row per GroupCommented on: 8 years ago
(October 20, 2006)
In order for the subquery to pick a random entry, you need to drop the ORDER BY clause, rather than using one.
Not sure why not all EmployeeId-s are returned, but this behaviour may already...
Digital Magazine Archives
Browse back issues of SQL Server Pro, from January 2007 through the last issue published in April 2014. Find the back issues here.