Hi, There is one table name as master with record as below. A/c No Dept 1 A 2 B 3 C 4 D 5 A 6 D 7 A 8 B Now i want the record which is duplicates in it.(only duplicates record should display) Like in above table A, D and B are duplicates so that only record should display with as many times they are present in table. Thanks, Vishal
Welcome to the forum! If I understand you correctly, you're looking for something like SELECT Dept FROM table GROUP BY Dept HAVING COUNT(*) > 1 Is this a homework question? []
<< Like in above table A, D and B are duplicates so that only record should display with as many times they are present in table. >> Not sure what you meant Do you want to list it as many times as there are data?
[quote user="vishu1484"] Yes [/quote] If this answer to my question SELECT t1.Dept FROM table as t1inner join ( SELECT Dept FROM table GROUP BY Dept HAVING COUNT(*) > 1 ) as t2 on t1.Dept=t2.Dept