DELETE FROM statproductsaleamount WHERE ID NOT IN ( SELECT OneId FROM ( SELECT MIN(ID) AS OneId, count(*) AS count FROM statproductsaleamount GROUP BY ShopName,DateOfData,supercode,pcode,scost HAVING count(*) >= 1 ) m )
DELETE FROM statproductsaleamount WHERE ID NOT IN ( SELECT OneId FROM ( SELECT MIN(ID) AS OneId, count(*) AS count FROM statproductsaleamount GROUP BY ShopName,DateOfData,supercode,pcode,scost HAVING count(*) >= 1 ) m )