SQL Query To Get Only Duplicates

The below SQL query we can get only Duplicates:

SELECT NAME,EMAIL,COUNT(*)

FROM DA31.TABLE1

GROUP BY NAME,EMAIL

HAVING COUNT(*) > 1;

So, after running this query we get only duplicate rows of NAME and EMAIL.

Comments

Popular posts from this blog

Top myths for NULL value in SQL Queries