Gossamer Forum
Home : General : Databases and SQL :

MYSQL COUNT() FUNCTION

Quote Reply
MYSQL COUNT() FUNCTION
I think I read somewhere that it is possible, but I can't remember where. Can I COUNT() a field in a table but NOT count doubles of the same thing?

Eg. Say you have logged a bunch of info in a database for website user logins or something.

Monday | User | Info

Tuesday | User | Info

Monday | User | Info

And we want to count how many DIFFERENT days were logged.

So the result we want in this case would be 2 being Monday and Tuesday rather than 3 (monday, tuesday, monday).

It seems like a very simple concept, I'm just not sure on the syntax to do this.

Last edited by:

JoFrRi: Aug 26, 2003, 3:53 PM
Quote Reply
Re: [JoFrRi] MYSQL COUNT() FUNCTION In reply to
Nevermind, I found it.

SELECT COUNT(DISTINCT row) FROM table;