SELECT * FROM tbl_name WHERE column_a IN ( val1, val2, val3 ) ORDER BY column_a = val1 DESC, column_a = val2 DESC, column_a = val3 DESC;Or
SELECT * FROM tbl_name WHERE column_a IN ( val1, val2, val3 ) ORDER BY FIELD(column_a, val1, val2, val3);
|maintain result set order with WHERE IN clause||8592||Jesse Hong||05/23/2008 04:15PM|
|Re: maintain result set order with WHERE IN clause||4432||William Chiquito||05/23/2008 08:26PM|
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.