SQL Query to find duplicates not returning any results
Posted
by TheDudeAbides
on Stack Overflow
See other posts from Stack Overflow
or by TheDudeAbides
Published on 2010-04-28T16:00:43Z
Indexed on
2010/04/28
16:03 UTC
Read the original article
Hit count: 310
sql-server
|sql
I know there are duplicate account numbers in this table, but this query returns no results.
SELECT [CARD NUMBER],[CUSTOMER NAME],[ACCT NBR 1],[ACCT NBR 2],
COUNT([ACCT NBR 1]) AS NumOccurences
FROM DebitCardData.dbo.['ATM Checking Accts - Active$']
GROUP BY [CARD NUMBER],[CUSTOMER NAME],[ACCT NBR 1],[ACCT NBR 2]
HAVING (COUNT([ACCT NBR 1])>1)
© Stack Overflow or respective owner