Archive

Archive for August, 2011

mysql order by in clause

August 8, 2011 Leave a comment

Need to order a query by the results pulled according to the order in the “in” clause:

SELECT * FROM tbl_name WHERE column_a IN ( val1, val2, val3 )
ORDER BY FIELD(column_a, val1, val2, val3);

Advertisements
Categories: mysql, php