Riya Verghese wrote:
> 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.
I think this is the real problem: outer query must know count(id) to
order by count(id). You can use it in the outer with something like this:
SELECTtable.*
FROMtableJOIN (SELECT id, count(id) AS count FROM... your subquery) AS x
ORDER BYx.count
Bye.