Dense_Rank was especially useful. Unlike Rank(), Dense_Rank() does not leaves gap in the sequence of numbers desginating ranks.
Showing posts with label rank. Show all posts
Showing posts with label rank. Show all posts
Tuesday, March 3, 2009
T-SQL: A Set-Oriented Language + Ranking Functions
The other day I had a query that invloved several tables and complex logic to a certain degree. The initial query involved using user-defined functions and the such and it took roughly 12 minutes to run which was not acceptable. After a little bit of tweeking and thinking of sets and not procedural logic I managed to the query to run in under 10 seconds for the same amount of data. Thanks partially to t-sql ranking functions [ http://msdn.microsoft.com/en-us/library/ms189798.aspx#]
Subscribe to:
Posts (Atom)