Hi i am facing an issue i have a sql server database with a table named products this table having 1000 records and each record gave a unique id but the other attributes are all same for some rows. here i want to delete that rows which are duplicate. how can i do this?
Hi Check out this article: http://www.xaprb.com/blog/2007/02/06/how-to-delete-duplicate-rows-with-sql-part-2/
selecting max id and putting this sub query in delete statement will work... delete * from table where id not in (select max id sub query)
if you set ur table to UNIQUE you shouldn't be getting duplicate entries, check ur tables and make sure u only have 1 set to UNIQUE, i had this problem a while ago and after i remade the table with only one field set to UNIQUE it fixed the problem