gausie Posted July 9, 2007 Share Posted July 9, 2007 I need to select all rows in my table that are duplicates. But the classification of being duplicates are if they have any other rows with the same "user_id" and "item_id". Even if the other columns are different, it is still a duplicate if those two are the duplicated anywhere. Can someone help me with this query? gausie Quote Link to comment https://forums.phpfreaks.com/topic/59106-specific-duplicate-finding/ Share on other sites More sharing options...
Wildbug Posted July 9, 2007 Share Posted July 9, 2007 SELECT CONCAT(user_id,' & ',item_id) AS useritem_id,COUNT(*) AS num FROM table GROUP BY useritem_id HAVING num > 1; Post table definition and an example case if you want more detail. Quote Link to comment https://forums.phpfreaks.com/topic/59106-specific-duplicate-finding/#findComment-293545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.