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: help : select unique values of a non-key field, tia

Re: help : select unique values of a non-key field, tia

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1998/02/06
Message-ID: <6bfcbq$g1t$1@news02.btx.dtag.de>#1/1

On Fri, 6 Feb 1998 20:17:54 +0800, "Lee Gwun Wai" <gwunwai_at_pacific.net.sg> wrote:
Hi Gwun,

assuming your table has a pk generated by a sequence, try:

SELECT a.name,a.age
from table a, (Select MIN(pk-field) min, age from table group by age) b where
a.pk-field = b.min
AND
a.age=b.age
order by age,name;

--
Regards
Matthias Gresz


>Hello everybody,
>
>How do I select unique values of a field that is not a key?
>
>For example, a Persons table with fields (Name, Age,....) where we can have
>more than 1 person sharing the same age.
>
>I want to get 1 name for every age there is in the table. 1 name for age 10,
>1 name for age 11,....
>
>Thanks in advance,
>Gwun Wai
>
>
-- Regards Matthias Gresz :-)
Received on Fri Feb 06 1998 - 00:00:00 CST

Original text of this message

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