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 |
|
Nickel
Starting Member
2 Posts |
Posted - 2005-08-31 : 08:32:38
|
| Hi all,I have a query below with Northwind db.select productname from products where categoryID in (6,2,7) order by categoryID Could anyone please help me to display the products in the given category order as 6,2,7. Thanks in advance,Nickel. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-31 : 08:37:53
|
| Try thisselect productname from products where categoryID in (6,2,7) order by case when Categoryid=6 then 1 when Categoryid=2 then 2 when Categoryid=7 then 3 end MadhivananFailing to plan is Planning to fail |
 |
|
|
Nickel
Starting Member
2 Posts |
Posted - 2005-08-31 : 10:21:44
|
| Thanks Madhi. |
 |
|
|
|
|
|