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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Select DISTINCT question

Re: Select DISTINCT question

From: <Jared.Still_at_radisys.com>
Date: Wed, 06 Feb 2002 10:38:05 -0800
Message-ID: <F001.004079C7.20020206095332@fatcity.com>

Ron,

GROUP BY does not promise to return rows in order. You must use ORDER BY for that.

Where's Larry Elkins? This is one of his favorite pet peeves.

I expected to hear from him on this. :)

Jared

"Ron Rogers" <RROGERS_at_galottery.org>
Sent by: root_at_fatcity.com
02/06/02 08:13 AM
Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        Re: Select DISTINCT question


Beth,
 Without going into very much detail about the two selects. 1 will return only the records that are distinct from each other and 2 will return all rows in a particular order. Using 1 could result in the elimination of records if there is more than one record that meets the distinct criteria. Order by will show duplicate records easily. ROR mª¿ªm

>>> Beth.Seefelt_at_TetleyUSA.com 02/06/02 09:53AM >>>

Hi everyone,

Is one of these more correct than the other ?

  1. select distinct customer_number, address_code from orders;
  2. select customer_number, address_code from orders group by customer_number,address_code;

Our developers do the 1st one mostly. It always bothers me, I'm not sure why, I guess I just think of it as looking ambiguous even though it
does return the same result as the second option.

Any opinions? Does it maReceived: from CONNECT-MTA by galottertter at all?

TIA, Beth

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Ron Rogers
  INET: RROGERS_at_galottery.org

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: Jared.Still_at_radisys.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Feb 06 2002 - 12:38:05 CST

Original text of this message

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