Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL get distinct values and count how many of each?

Tags:

mysql

There is a status column. I need to pull all the distinct values for each one, and a number indicating how many times each unique value is in the table.

Is there a way to do that?

Thanks.

like image 840
JD Isaacks Avatar asked Aug 10 '09 15:08

JD Isaacks


1 Answers

SELECT status, count(*) as c FROM table GROUP By status;
like image 56
Rufinus Avatar answered Oct 10 '22 01:10

Rufinus