select allmastid, count(allmastid) from BillTypeSet group by AllMastId having count(AllMastId)>1 select allmastid, count(allmastid) from BillTypeSet group by AllMastId having count(AllMastId)>1 select * from BillTypeSet where AllMastId='40' delete from BillTypeSet where BillTypeSetId='BTS_64_001'