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 |
froggy
Starting Member
14 Posts |
Posted - 2006-10-25 : 02:24:47
|
Hi, in my database, there are multiple IDs. for each id in the role column, they will either be Immediate, Extended or Stand-down. In my query, they will group all IDs with the same role together and return them in an ASC order which is Extended, Immediate then Stand-Down. However, i would need the order to be Immediate, Extended then Stand-down. How is my SQL statement suppose to be? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-25 : 02:40:55
|
Homework?select * from mytableorder by case when id = 'immediate' then 1 when id = 'extended' then 0 when id = 'stand-down' then 2 else 32767 endPeter LarssonHelsingborg, Sweden |
 |
|
froggy
Starting Member
14 Posts |
Posted - 2006-10-25 : 03:00:26
|
Hihi, yupyup, this is a homework assignment which i got to do. I have to create a website which return in the order Immediate, Extended, Stand-down. Do i simply insert the statement into my webpage, don't think it works. is there anything which i had missed? |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-25 : 03:12:14
|
My suggested query will work for you. But I think you have to change some names to fit your platform.Read the query and try to understand the logic behind the text.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|
|