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

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

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Tue, 23 Apr 2002 15:04:30 GMT
Message-ID: <3CC577EE.9E22A45B@exesolutions.com>


Look at using GROUP BY and HAVING.

Daniel Morgan

C Chang wrote:

> 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 Tue Apr 23 2002 - 10:04:30 CDT

Original text of this message

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