How to display records from a table ordered as in the where clause?
问题 I am trying to display the records,order as in the where clause.. example: select name from table where name in ('Yaksha','Arun','Naveen'); It displays Arun,Naveen,Yaksha (alphabetical order) I want display it as same order i.e 'Yaksha''Arun','Naveen' how to display this... I am using oracle db. 回答1: Add this ORDER BY at the query's end: order by case name when 'Yaksha' then 1 when 'Arun' then 2 when 'Naveen' then 3 end (There's no other way to get that order. You need an ORDER BY to get a