Categorized | database

Find and Delete Duplicates value from SQL table

Here a query for finding duplicates in a table. Suppose you want to find all ‘Coupon Code’  in a table that exist more than once

SELECT Coupon_Code
FROM Coupon
GROUP BY Coupon_Code
HAVING ( COUNT(Coupon_Code) > 1 )
Delete duplicate value from table
DELETE FROM Coupon
GROUP BY Coupon_Code
HAVING ( COUNT(Coupon_Code) > 1 )


Leave a Reply


  • Popular
  • Latest
  • Comments
  • Tags
  • Subscribe

43,837
Unique
Visitors
Powered By Google Analytics