Friday, March 7, 2014

how to select duplicate records in sql

First we do grouping of all the records in the table then display only those records whose count is greater than 1.
For more more details see the Emp table and Output result

Query: Select sal from emp group by sal having count(sal) > 1

Displays all the salaries which are duplicate in Emp table.

Image will not be available