How to use IN statement with ORDER BY asc/desc in ORACLE queries?
Following queries worked properly, which are without IN statement:
1-SELECT ROLE,NAME,INSTITUTION
FROM ROLE
ORDER BY INSTITUTION ASC
2-Select Error, NAME,DESCRIPTION,FILE,CATEGORY
from errorcodes ORDER BY CODE ASC;
but when I use ORACLE query with IN it gives error, the query is:
3-SELECT *
FROM CUST
WHERE ORDER BY Channel IN ('0007', '9999','0001') ASC;
How can I write the above query properly?
Thanks in advance.
Manikavelu VelayuthamPosted Sep 20, 2010, 3:37 AM
SELECT *
FROM CUST
WHERE Channel IN ('0007', '9999','0001') ORDER BY Channel ASC;
Suthish NairPosted Sep 20, 2010, 4:02 AM
try this..
select * from
(
select rownum, a.* from cust a where channel in ('0007', '9999','0001')
)
order by rownum desc;
Noushad MohPosted Sep 20, 2010, 3:57 AM