Thread: SQL ORDER BY
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default SQL ORDER BY

You'll have to use something like decode() to do this.

.... order by decode(ID,6,1,2,2,8,3)

or whatever is the equivalent in your particular database.

Tim

"Kalle" wrote in message
...

HI

I use this question and it works fine but I want to sort it in the same
order as the "IN list"

SELECT ID, firstname, lastname FRON person WHERE ID IN (6,2,8)

Now I want it to be sorted in the same order as "IN (6,2,8)" I mhave
tried ORDER BY FIELD(ID, 6,2,8) but then I get an error

IS thier someone who knows somthing about this?

Thanks in advance


*** Sent via Developersdex http://www.developersdex.com ***