jasonc Posted January 7, 2012 Share Posted January 7, 2012 I have got this far and would like to find out how I change the query so it shows all duplicates instead of just one of them. SELECT count(*), `id`, `linklocation`, `link` FROM `links` WHERE `link` != '' GROUP BY `link` having count(*) > 1 Quote Link to comment https://forums.phpfreaks.com/topic/254544-how-to-show-all-duplicates-in-a-single-field/ Share on other sites More sharing options...
fenway Posted January 7, 2012 Share Posted January 7, 2012 Drop the GROUP BY -- use a self-join instead. Quote Link to comment https://forums.phpfreaks.com/topic/254544-how-to-show-all-duplicates-in-a-single-field/#findComment-1305279 Share on other sites More sharing options...
jasonc Posted January 7, 2012 Author Share Posted January 7, 2012 I tried the following SELECT * FROM `links` WHERE `link` IN ( SELECT `link` FROM `links` GROUP BY `link` HAVING count(*) > 1 ) ORDER BY `id` DESC But it caused the server error 500, so I entered it in phpmyadmin and got no results. Quote Link to comment https://forums.phpfreaks.com/topic/254544-how-to-show-all-duplicates-in-a-single-field/#findComment-1305359 Share on other sites More sharing options...
fenway Posted January 8, 2012 Share Posted January 8, 2012 The 500 error has nothing to do with MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/254544-how-to-show-all-duplicates-in-a-single-field/#findComment-1305545 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.