PTS Posted June 14, 2007 Share Posted June 14, 2007 Hey, this is probably an easy answer that I should know but I completely forgot. How do you display the number of times a particular entry appears in a column of a database? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/55646-number-of-identical-entries-in-mysql-db-column/ Share on other sites More sharing options...
btherl Posted June 15, 2007 Share Posted June 15, 2007 SELECT column, count(*) FROM table GROUP BY column ORDER BY count(*) DESC The ordering is optional of course, but that's usually the order you want. You can also add "HAVING count(*) > 1" if you want to display only values which appear more than once. Quote Link to comment https://forums.phpfreaks.com/topic/55646-number-of-identical-entries-in-mysql-db-column/#findComment-275071 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.