Return-Path: <ml-errors@fatcity.com>
Received: from ensim.rackshack.net (root@localhost)
 by orafaq.net (8.11.6/8.11.6) with ESMTP id h8PBOoL21575
 for <oracle-l@orafaq.net>; Thu, 25 Sep 2003 06:24:50 -0500
X-ClientAddr: 66.27.56.213
Received: from www2.fatcity.com (rrcs-west-66-27-56-213.biz.rr.com [66.27.56.213])
 by ensim.rackshack.net (8.11.6/8.11.6) with ESMTP id h8PBOnc21570
 for <oracle-l@orafaq.net>; Thu, 25 Sep 2003 06:24:50 -0500
Received: (from root@localhost)
 by www2.fatcity.com (8.11.6/8.11.6) id h8P8kCo08391
 for oracle-l@orafaq.net; Thu, 25 Sep 2003 01:46:12 -0700
Received: by fatcity.com (05-Jun-2003/v1.0g-b73/bab) via fatcity.com id 005D0F85; Thu, 25 Sep 2003 01:44:40 -0800
Message-ID: <F001.005D0F85.20030925014440@fatcity.com>
Date: Thu, 25 Sep 2003 01:44:40 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Robson, Peter" <pgro@bgs.ac.uk>
Sender: ml-errors@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Robson, Peter" <pgro@bgs.ac.uk>
Subject: RE: select distinct values
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 73; ListGuru (c) 1996-2003 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Whoa there!

See below:


> -----Original Message-----
> From: elain he [mailto:elainhe@hotmail.com]
> Sent: Tuesday, September 23, 2003 9:40 PM
> To: Multiple recipients of list ORACLE-L
> Subject: select distinct values
> 
> 
> Hi,
> Could someone shed some light on this.
> 
> I'm trying to formulate a query to return distinct value on a 
> column - 
> testid.
> 
> select * from testing;
> TESTID NAME             STATUS
> ---------- -------------------- -----------
>          1 MIKE                  Y
>          1 JOE                   Y
>          1 JIM                    Y
>          2 AMY                  Y
> 
> The output I'm expecting is
> TESTID NAME             STATUS
> ---------- -------------------- -----------
>          1 MIKE                  Y
>          2 AMY                   Y
> 

**************************

This sentance contains a fundamental error of understanding of a relational
db.
> 
> The query should display the first occurence of the testid and ignore 
> records with the same testid.
> 


The ORDER in which rows are retrieved from a table is not, never, ever will
be significant. By definition.

So if you can find a script which appears to give you the correct result for
this example, then sure as eggs is eggs, it will fail on another data set.
There is NOTHING in your example data set which enables a logical predicate
to establish precedence of any one row with Testid=1 over another.

peter
edinburgh

************************

> thanks!
> 
> elain
> 
> _________________________________________________________________
> Instant message in style with MSN Messenger 6.0. Download it 
> now FREE!  
> http://msnmessenger-download.com
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> -- 
> Author: elain he
>   INET: elainhe@hotmail.com
> 
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru@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).
> 


*********************************************************************
This  e-mail  message,  and  any  files  transmitted  with  it, are
confidential  and intended  solely for the  use of the  addressee. If
this message was not addressed to  you, you have received it in error
and any  copying,  distribution  or  other use  of any part  of it is
strictly prohibited. Any views or opinions presented are solely those
of the sender and do not necessarily represent  those of the British
Geological  Survey. The  security of e-mail  communication  cannot be
guaranteed and the BGS accepts no liability  for claims arising as a
result of the use of this medium to  transmit messages from or to the
BGS. .                            http://www.bgs.ac.uk
*********************************************************************

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Robson, Peter
  INET: pgro@bgs.ac.uk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@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).

