If I have a table like the following: and I want to select the highlighted rows because they are duplicates (values are the same apart from id) then how could/would I do this? So rows 1,3,4,5,9,10 would be returned
something like this should do it select t.* from <tablename> t join (select col2, col3, itemid, count(*) from <tablename> group by col2, col3, itemid having count(*) > 1) m on m.col2 = t.col2 and m.col3 = p.col3 and m.itemid = t.itemid
SELECT * FROM table WHERE tablefield IN ( SELECT tablefield FROM table GROUP BY tablefield HAVING (COUNT(tablefield ) > 1) )