Sql Server Count Duplicate Records – Rows

Count Duplicate Records – Rows

If We have a table like following and we need to find No of Duplicate column than follow 

1	AAA	CCC
2	BBB	CCC
2	BBB	DDD
3	CCC	DDD
3	CCC	DDD
3	CCC	DDD
1	AAA	CCC
1	AAA	CCC
1	AAA	CCC
1	AAA	CCC
2	BBB	DDD
2	BBB	DDD


If You want to Count Duplicate Values in Column 

SELECT ID , COUNT (*) AS COUNTMULIPLE FROM SAMPLE 
GROUP BY ID 
HAVING COUNT(*) > 1

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s