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

Home -> Community -> Usenet -> c.d.o.server -> Re: sql question - distinct

Re: sql question - distinct

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 27 Nov 2006 16:23:17 -0800
Message-ID: <1164673397.399226.179010@f16g2000cwb.googlegroups.com>


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 Portas
Received on Mon Nov 27 2006 - 18:23:17 CST

Original text of this message

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