Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> DISTINCT/ORDER BY
I have a query that needs return a list of CATEGORY and sorted by
another field. There may be duplicate CATEGORY values, so I need to do
something similar to DISTINCT.
The following sorts correctly, but shows duplicates.
select category
from TheTable
ORDER BY thesequence
So I added DISTINCT to it:
select distinct category
from TheTable
ORDER BY thesequence
and get the error ORA-01791: not a SELECTed expression
If I add thesequence to the SELECT, then I loose the DISTINCT. How can I do this?
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Oct 22 1999 - 16:08:15 CDT