If PERSON_ID is unique and you have an index on SOC_SEC_NO, you can find
all records with duplicate SOC_SEC_NO this way (ordered by SOC_SEC_NO, so
that they are kind of grouped together):
SELECT *
FROM PERSON P
WHERE EXISTS(SELECT * FROM PERSON P2
WHERE P.PERSON_ID <> P2.PERSON_ID
ope this is useful,
Edward
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Sent: Thursday, February 4, 2016 3:09 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How do find duplicates in a table?
Thanks Woody much simpler.
F
04.02.2016 20:09, 'stwizard' stwiz...@att.net [firebird-support] wrote:
> How do I form a SQL Select statement that will return which records in my
> PERSON table
> have duplicate SOC_SEC_NO.
RTFM GROUP BY, HAVING, COUNT().
--
WBR, SD.
ort@yahoogroups.com
Subject: Re: [firebird-support] How do find duplicates in a table?
04.02.2016 20:09, 'stwizard' stwiz...@att.net [firebird-support] wrote:
> How do I form a SQL Select statement that will return which records in
> my PERSON table have duplicate SOC_SEC_NO.
RTFM GROUP B
Greetings All,
How do I form a SQL Select statement that will return which records in my
PERSON table have duplicate SOC_SEC_NO.
In other words I need a list of persons where the social security number
appears in the database more than once. Some SOC_SEC_NO may be null which I do
not
ard' stwiz...@att.net [firebird-support]
Sent: Thursday, February 04, 2016 1:37 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] How do find duplicates in a table?
I had finally figured it out just before your reply
SELECT DISTINCT P.SOC_SEC_NO,
(SELECT CO
age-
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Sent: Thursday, February 04, 2016 1:25 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How do find duplicates in a table?
04.02.2016 20:09, 'stwizard' stwiz...@att.net [firebird-supp
ect: [firebird-support] How do find duplicates in a table?
Greetings All,
How do I form a SQL Select statement that will return which records in my
PERSON table have duplicate SOC_SEC_NO.
In other words I need a list of persons where the social security number
appears in the datab
Thanks Woody much simpler.
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com]
Sent: Thursday, February 04, 2016 1:42 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How do find duplicates in a table?
Try this instead:
Select Soc_Sec_No