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 -> How do I select distinct from duplicated records and order by other column?

How do I select distinct from duplicated records and order by other column?

From: C Chang <cschang_at_maxinter.net>
Date: Mon, 22 Apr 2002 21:27:35 -0400
Message-ID: <3CC4B887.30EC@maxinter.net>


I have a set of records TableA as

col1 col2 col3 col4

1       D      AA     D4
2       B      BB     B4
3       C      CC     C4
4       A      DD     A4
2       B      BB     B4

I can not use the
select distinct(col1), col2, col3, col4
from tableA
where ..
order by col2; <-- Can be changed dynamically? It generates an error that " not onSelect expression" due to the col# that order by is not constant.
And I can not put every columns in a group by either. So soes anyone have a good suggestion? Thanks.

C Chang Received on Mon Apr 22 2002 - 20:27:35 CDT

Original text of this message

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