On 02/14/2007 01:46 PM, Adrian Noland wrote:
> I have the following query:
> select id, categories from dd_categories where id in (21, 20, 13, 3, 22,
> 31);
> 
> I want category 21 to show up first in the list.

SELECT
        id, categories
FROM
        dd_categories
WHERE
        id IN (21, 20, 13, 3, 22, 31)
ORDER BY
        FIELD(id, 21) DESC, id;


http://dev.mysql.com/doc/refman/5.0/en/string-functions.html


_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to