Question : SQL Query dense rank

How can I display 1 and 2, 3.. ranking for Items that have a ranking of 2 or more

Answer : SQL Query dense rank

wait a second, shouldn't you be using row_number rather than rank?

I am a bit confused with your question.

You could do

select * from (
select ranking = row_number() over(partition by itemnumber, productnumber, cdate order by itemnumber, productnumber, cdate) rownum, *
from Pricing
) numberedRows
where rownum >2

and if you want to have numbers for duplicates shifted (so that you see it 1,2,3 rather than 2,3,4 in first select you should put

select rownum-1, * from......
Random Solutions  
 
programming4us programming4us