I have a stmt where the outer-query is limited by the
results of the inner query. I would like the outer query to return records in
the same order as the values provided in the IN clause (returned form the inner
query). The inner_query is returning id’s ordered by count(id)
, i.e by most common occurrence. In essence, when I say select * from table where id IN (2003,1342,799, 1450) I would like the records to be ordered as 2003, 1342, 799,
1450. The outer query has no knowledge of the count(id) that the inner_query
is ordering by. Currently postgres returns it in this order
(1450,1342,799,2003) Any help would be appreciated. Thanks, R. Verghese |
- [SQL] ORDER records based on parameters in IN clause Riya Verghese
- Re: [SQL] ORDER records based on parameters in IN... Michael Fuhr
- Re: [SQL] ORDER records based on parameters in IN... Greg Sabino Mullane
- Re: [SQL] ORDER records based on parameters i... Russell Simpkins
- Re: [SQL] ORDER records based on parameters i... Michael Fuhr
- Re: [SQL] ORDER records based on paramete... Russell Simpkins
- Re: [SQL] ORDER records based on para... Michael Fuhr
- Re: [SQL] ORDER records based on para... Scott Marlowe
- Re: [SQL] ORDER records based on... M.D.G. Lange
- Re: [SQL] ORDER records base... Dawid Kuroczko
- Re: [SQL] ORDER records base... Daryl Richter