Find and Delete Duplicates value from SQL table

Posted In database - By admin On Wednesday, September 16th, 2009 With 0 Comments

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 )


About -

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>