From: Perrin Harkins Date: June 5 2009 9:00pm Subject: Re: Ordering an IN query List-Archive: http://lists.mysql.com/mysql/217809 Message-Id: <66887a3d0906051400y701a1431n1ff4c602eaaf8c17@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Jun 5, 2009 at 9:09 AM, Aaron Fischer wrote: > So I build the query in the order that I want it displayed. =A0That is di= splay > 221593, then 221591, then CC3762, etc. =A0However, when the query is exec= uted > it looks like it automatically sorts the codes in ascending order, so I g= et > 221591, then 221593, the CC0059, etc. > > I want the results displayed in the order that I build the query. =A0Is t= here > some way of doing that? You'll have to use a function like CASE() or FIND_IN_SET() to map the IDs to values in an ORDER BY clause. - Perrin