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 |
|
phrankbooth
Posting Yak Master
162 Posts |
Posted - 2011-12-20 : 17:20:48
|
| I have a result set that is like this:empID, year, growth%I'd like to RANK empID by highest growth%.Sometimes the growth is 0.00 and I'd like those to be ranked last and not ranked as #1.Any ideas appreciated, thanks!!--PhB |
|
|
etrek42
Starting Member
3 Posts |
Posted - 2011-12-20 : 17:30:21
|
| if i correctly understood your question ORDER BY should solve this.SELECT empID FROM resultORDER BY growth% DESC |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-12-21 : 03:09:35
|
| You need to post some sample data with expected resultorder by case when somevalue then 1 else 0 end, somevalueMadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-21 : 03:28:32
|
[code]ORDER BY case when growth = 0 then 2 else 1 end, growth [/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|