Lets the table name is report and its have a two field, id and type.
type contain a numbers of duplicate records...
first retrieve the all records from table:
select type,id from report;
type | id |
php | 1 |
php | 2 |
mysql | 3 |
mysql | 4 |
lamp | 5 |
lamp | 6 |
use command:
select count(type), id from report group by type having count(type)>1;
get the records like this:
count(type) | id |
2 | 1 |
2 | 2 |
2 | 3 |
the above table explains the id 1,2,3 contain the 2 number of duplicates data.
No comments:
Post a Comment