MySQL count elements in a database based on how many unique values there are in a field.

Posted by 0plus1 on Stack Overflow See other posts from Stack Overflow or by 0plus1
Published on 2010-05-16T11:08:07Z Indexed on 2010/05/16 11:10 UTC
Read the original article Hit count: 234

Filed under:
|

(Sorry for the title, I don't really know how to phrase that :-) )

I have a table that has a date and a uid fields.

I need to get the number of uid for each date, currently I'm doing it in php running multiple queries like this one:

SELECT COUNT(uid) FROM users where Date = 'xxx';

Is there a simple way to achieve this with only an sql query?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-query