Reputation: 153
trying to get normal price rating using
ROW_NUMBER() OVER(PARTITION BY [id] ORDER BY [price] asc) as [Rating]
But I need rating like:
I know thats suppose to be easy - but google didnt gave me any idea. Need you help
Upvotes: 0
Views: 33
Reputation: 7666
Take DENSE_RANK()
instead of ROW_NUMBER()
. Then it should work:
DENSE_RANK OVER(PARTITION BY [id] ORDER BY [price] ASC) AS [Rating]
Upvotes: 1