[nycphp-talk] OT: Random MySQL question
Jon Baer
jonbaer at jonbaer.com
Wed Feb 14 17:14:47 EST 2007
Interesting how you can walk down the entire list to produce the
order you need like that.
On Feb 14, 2007, at 3:51 PM, Flavio daCosta wrote:
> On 02/14/2007 03:37 PM, Jon Baer wrote:
>> Interesting question but this *would* seem to work ...
>>
>> select id, categories from dd_categories where id in (21, 20, 13,
>> 3, 22,
>> 31) order by id = 21 desc;
>>
>> Anyone else test, confirm or answer why?
>
> id = 21 is evaluated to TRUE or FALSE and then sorted based on that.
> _______________________________________________
> 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
More information about the talk
mailing list