Monday, June 11, 2012

Ordering and Ranking a data set

useful technique to pre-order data set


select
DENSE_RANK() over (order by name_first),
RANK() over (order by name_first),
ROW_NUMBER() over (order by name_first),
ROW_NUMBER() over (order by name_last),
*
from users
order by name_first, name_last

No comments: