In article <[EMAIL PROTECTED]>, "Andrew Dixon - MSO.net" <[EMAIL PROTECTED]> writes:
> Hi Everyone. > I'm not sure if this is possible of not, but I want to sort a query by a > comma list. Here is what I'm doing: > SELECT id, title, description > FROM table1 > WHERE id IN (4,1,3,6,8,2) > This returns the results ok but they are not in any particular order. I want > the result in the order the ID's appear in the comma list in the IN > statement. Is there a ORDER BY statement I can add to do this? > So what I want to do is: > SELECT id, title, description > FROM table1 > WHERE id IN (4,1,3,6,8,2) > ORDER BY id in this order (4,1,3,6,8,2) I think SELECT id, title, description FROM table1 WHERE id IN (4,1,3,6,8,2) ORDER BY field(id,4,1,3,6,8,2) should work. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]