Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g7TNAfS07958
 for <oracle-l@naude.co.za>; Thu, 29 Aug 2002 19:10:41 -0400
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id QAA72886;
 Thu, 29 Aug 2002 16:08:14 -0700 (PDT)
Received: by fatcity.com (26-Feb-2001/v1.0g-b72/bab) via UUCP id 004C3699; Thu, 29 Aug 2002 15:47:08 -0800
Message-ID: <F001.004C3699.20020829154708@fatcity.com>
Date: Thu, 29 Aug 2002 15:47:08 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Fink, Dan" <Dan.Fink@mdx.com>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Fink, Dan" <Dan.Fink@mdx.com>
Subject: RE: Select count(name) from table group by name where count(name)
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 72; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: text/plain;	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Use HAVING count(name) = 1

Example from our good friend scott.emp

SQL> select job, count(job)
  2  from emp
  3  group by job;

JOB       COUNT(JOB)
--------- ----------
ANALYST            2
CLERK              4
MANAGER            3
PRESIDENT          1
SALESMAN           4
                   0

6 rows selected.

SQL> i
  4  having count(job) = 1
  5  
SQL> l
  1  select job, count(job)
  2  from emp
  3  group by job
  4* having count(job) = 1
SQL> /

JOB       COUNT(JOB)
--------- ----------
PRESIDENT          1


-----Original Message-----
Sent: Thursday, August 29, 2002 4:39 PM
To: Multiple recipients of list ORACLE-L
1


Hello guys,

I am baffled by this problem.

I need to fish out the person's name from a list but I only want the 
name of the person that occurs once in the list - minus those names that 
occurs more than once.

Now, I know about "distinct" and "unique", but this is not what I want. 
All I want is to be able to fish out the names of the people who have 
only one and exactly only one entry in the list. I do not want the names 
of those people who have more than one entry in the list.

Could one of you do me a huge favor give me some hints as to how to 
contruct the select statement for this.

Thanks.

ltiu


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: ltiu
  INET: ltiu@alumni.sfu.ca

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@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: Fink, Dan
  INET: Dan.Fink@mdx.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@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).

