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. 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. 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
Archived
This topic is now archived and is closed to further replies.