Also,  if you want to get back the PERSON records instead of the SOC_SEC_NO
try.

 

WITH CTE

AS (SELECT SOC_SEC_NO

    FROM PERSON 

    GROUP BY SOC_SEC_NO

    HAVING COUNT(*) > 1)

SELECT PERSON.*

FROM PERSON 

INNER JOIN CTE ON (CTE.SOC_SEC_NO = PERSON.SOC_SEC_NO)    

 

 

Hope 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.

 

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, count(*) from Person
group by Soc_Sec_No
having count(*) > 1

This will list the social security numbers and the count if there are 
more than one without
all the additional selects.

HTH
Woody (TMW)






  • [firebird-sup... 'stwizard' stwiz...@att.net [firebird-support]
    • Re: [fir... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
      • RE: ... 'stwizard' stwiz...@att.net [firebird-support]
        • ... 'Woody' woody-...@gt.rr.com [firebird-support]
          • ... 'stwizard' stwiz...@att.net [firebird-support]
            • ... 'Edward Mendez' emendez...@nc.rr.com [firebird-support]
        • ... Alexey Kovyazin a...@ib-aid.com [firebird-support]
    • RE: [fir... Peterson Seridonio loukinh...@hotmail.com [firebird-support]
    • Re: [fir... Svein Erling Tysvær setys...@gmail.com [firebird-support]

Reply via email to