List:General Discussion« Previous MessageNext Message »
From:Perrin Harkins Date:June 5 2009 9:00pm
Subject:Re: Ordering an IN query
View as plain text  
On Fri, Jun 5, 2009 at 9:09 AM, Aaron Fischer<afischer@stripped> wrote:
> So I build the query in the order that I want it displayed.  That is display
> 221593, then 221591, then CC3762, etc.  However, when the query is executed
> it looks like it automatically sorts the codes in ascending order, so I get
> 221591, then 221593, the CC0059, etc.
>
> I want the results displayed in the order that I build the query.  Is there
> 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
Thread
Ordering an IN queryAaron Fischer5 Jun
  • RE: Ordering an IN queryMartin Gainty5 Jun
  • Re: Ordering an IN queryPerrin Harkins5 Jun