[Q]: sql or pl/sql solution

From: Neil Greene <neil_at_kynug.org>
Date: Thu, 4 Aug 1994 14:29:44 GMT
Message-ID: <1994Aug4.142944.11336_at_KYnug.org>


I have the following sql script:

> break on ss skip 1
>
> column fname format a20
> column lname format a20
>
> spool &spoolfile
> set termout off
> SELECT
> ss, nasrisid, fname, lname, birthdate
> FROM
> master
> WHERE
> ss > '0'
> ORDER BY
> ss asc;
> spool off

That creates reports like the following:

> SS NASRISID FNAME LNAME BIRTHDATE
> --------- ---------- -------------------- -------------------- ---------
> 999999999 972843 GINNY BELDING 19-FEB-64
> 972863 BERNIE PLINIO 28-OCT-62
> 974959 DONNA KENDALL 13-MAY-70
> 974991 MICHAEL TABOR 28-OCT-44
> 974897 JR., GARCIA 05-JUN-71
> 974914 LOLETHA SAUNDERS 22-OCT-53
> 975100 GEIR SMEBY 12-AUG-68
> 975101 ROAR SMEBY 19-SEP-70
> 975104 ANJA ZUHLSDORF 26-AUG-67
> 975165 ANDREW SMITH 14-AUG-49
> 975273 MITCHELL WOOLRICH 30-SEP-37
>
> 101010101 972843 SMITH BELDING 19-FEB-64
>
> 101010102 972843 JAMES BELDING 19-FEB-64
>
> 101010103 972843 GREEN BELDING 19-FEB-64
All of the applicants in the database a grouped by matching social security numbers. Which is exactly what I want, except, I do not want the report to print if there is only one applicant witha particular social security number, only where there is more then one. Of course, using the group function, I can't get the individual rows to print. Is there a way to do this in straight sql or do I need to write a pl/sql solution to this.

I was thinking something that uses the group function and having count > 1 would do it, but that doesn't work. Any suggestions?

-- 
Neil Greene
benchMark Developments, Inc. [NeXT VAR]
2040 Regency Road, Suite C Lexington, KY 40503
Phone: 606-231-6599 / Fax: 606-254-4864
Received on Thu Aug 04 1994 - 16:29:44 CEST

Original text of this message