MySQL - SELECT ... WHERE id IN (..) - correct order -
i have following query
select * table id in (5,4,3,1,6)
and want retrieve elements in order specified in "id in.." meaning should return:
5 .... 4 .... 3 .... 1 .... 6 ....
any ideas how that?
use field():
select * table id in (5,4,3,1,6) order field(id, 5,4,3,1,6);
Comments
Post a Comment