RE: Order by umm OR?

2003-08-04 Thread Yoed
ype tables when that happens I don't know a work around for that either. Best, Yoed -Original Message- From: Kevin Fries [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 10:59 AM To: 'Yoed' Subject: RE: Order by umm OR? Wow. Thousands of items in your IN cl

Re: Order by umm OR?

2003-08-01 Thread Roger Baklund
* Yoed > Lets say I have a query similar to: > > SELECT * FROM company WHERE id='3' OR id='1' OR id='7' ; > > I want to be able to get the results to come out ordered by the order > the ids were searched (the sequence in the WHERE OR; 3 first then 1, > then 7...), so the results would be like: > >

RE: Order by umm OR?

2003-08-01 Thread Kevin Fries
Not surprising, the dbms has no built-in support for ordering rows by the filters in the where clause. But with a bit of programming you should be able to construct a useful ORDER BY clause to do what you want... SELECT * FROM company WHERE id='3' OR id='1' OR id='7' ORDER BY CASE id when '3' then