Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2015-04-18 : 17:16:26
|
Hello there. I have a question with a row number. Below I have 2 columns that I want toPut a row number with. ID. Quantity DesiredRowNumber123 1. 1123. 1 1123. 1. 1123. 3 2123. 3. 2123. 4 3123. 5 4123. 5. 4123. 7 5123. 7. 5789. 1 1789. 1. 1789. 3 2789. 3. 2789 4 3789. 5 4789. 5. 4789. 7 5789. 7. 5How would I get the desired row number. Many thanks. |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-04-18 : 18:54:48
|
[code]select id, quantity , rn = dense_Rank() over(partition by id order by quantity)from table[/code] |
|
|
|
|
|