Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: sql question - distinct
soalvajavab1_at_yahoo.com wrote:
> How can I apply DISTINCT only to the first column in this query:
>
> SELECT DISTINCT UNIT_ID, BFP_NUMBER, METER_NUMBER
> FROM table_1
>
> It applies it to all 3 fields now. Pls advise.
What values do you expect to see in the other columns? Maybe MIN or MAX? For example:
SELECT UNIT_ID,
MIN(BFP_NUMBER) AS BFP_NUMBER,
MIN(METER_NUMBER) AS METER_NUMBER
FROM table_1
GROUP BY UNIT_ID;
-- David PortasReceived on Mon Nov 27 2006 - 18:23:17 CST
![]() |
![]() |