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 |
|
kotonikak
Yak Posting Veteran
92 Posts |
Posted - 2012-06-14 : 12:08:09
|
| This is probably a really easy question but I can't seem to figure out how to set the following increasing sequence numbers to the decreasing LossAmount values:Sequence LossAmount1 10001 10002 9003 8003 8003 800When I didn't have repeating LossAmount values, I found the sequence by doing the following:seq = ROW_NUMBER() over (order by LossAmount desc)which is nice and easy....but now I'm not quite sure how to do it for repeated values. Should be an easy question but I'm stuck...any help is appreciated! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-14 : 12:10:17
|
| seq = DENSE_RANK() OVER (ORDER BY LossAmount DESC)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
kotonikak
Yak Posting Veteran
92 Posts |
Posted - 2012-06-14 : 12:13:40
|
| thanks! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-14 : 12:20:55
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|