I execute the SELECT and it works!. I have MySQL 4.0.4

Regards,
Ulises

-----Mensaje original-----
De: motorpsychkill [mailto:[EMAIL PROTECTED]
Enviado el: Jueves 7 de Agosto de 2003 04:43 PM
Para: mysql
Asunto: RE: order by question

> -----Original Message-----
> From: Roger Baklund [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 07, 2003 10:54 AM
> To: mysql
> Cc: motorpsychkill
> Subject: Re: order by question
>
>
> * motorpsychkill
> > SELECT  *  FROM kf_gallery WHERE gallery_id IN ( 3, 1, 2 )  ORDER  BY ?
> >
> > What I'm trying to do is get the results in the order specified
> > in the "IN"
> > clause, i.e. (3, 2, 1).  Is this possible?  (I'm having trouble
> searching
> > the mail archives).  Thanks!
>
> Use the FIELD() function:
>
> SELECT  *  FROM kf_gallery
>   WHERE gallery_id IN ( 3, 1, 2 )
>   ORDER  BY FIELD(gallery_id, 3, 1, 2)
>
> HTH,
>
> --
> Roger

Thanks Roger, but that didn't seem to work.  It still gave me the results
ASC, i.e. by gallery_id 1, 2, 3.  Anyone else? :)

Reply via email to