Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> DISTINCT/ORDER BY

DISTINCT/ORDER BY

From: <hummels_at_tce.com>
Date: Fri, 22 Oct 1999 21:08:15 GMT
Message-ID: <7uqjnu$grp$1@nnrp1.deja.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US