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
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
This may works.
SELECT PERSON.PERSON_ID, COUNT(PERSON.SOC_SEC_NO) FROM PERSON HAVING
COUNT(PERSON.SOC_SEC_NO) > 1;
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: quinta-feira, 4 de fevereiro de 2016 17:10
To: firebird-support@yahoogroups.com
Subject:
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