Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need help with deleting rows

Author  Topic 

diwawaits
Starting Member

1 Post

Posted - 2007-04-03 : 14:14:30
Hi i'm a learner of sql,

i need help in deleting rows from a table that have multiple occurences of a value.

the table has a column named product_id , i need to find out what rows have the product_id value repeated ( i.e not distinct)

how do i do that help please.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-03 : 14:18:08
select product_id from table1 group by product_id having count(*) > 1 order by product_id


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -