I think he just misread the "group by" as an "order by"

-----Original Message-----
Sent: Wednesday, February 06, 2002 12:08 PM
To: Multiple recipients of list ORACLE-L



Ron,

What am I missing?  Both selects will ALWAYS return the same data. Correct???

Rick


                                                                                       
                            
                    "Ron Rogers"                                                       
                            
                    <RROGERS@galo        To:     Multiple recipients of list ORACLE-L 
<[EMAIL PROTECTED]>       
                    ttery.org>           cc:                                           
                            
                    Sent by:             Subject:     Re: Select DISTINCT question     
                            
                    root@fatcity.                                                      
                            
                    com                                                                
                            
                                                                                       
                            
                                                                                       
                            
                    02/06/2002                                                         
                            
                    11:13 AM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    ORACLE-L                                                           
                            
                                                                                       
                            
                                                                                       
                            




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

>>> [EMAIL PROTECTED] 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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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: Seefelt, Beth
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to