neptune
neptune

Reputation: 43

Count rows in a MySQL table that were added today

I have a table for users where I have a date type column which stands for the date that they created their accounts and I wanted to count the rows of that table that were added "today" so that I could see how many people created an account everyday.

What's the most effiecient way to do this?

Upvotes: 0

Views: 462

Answers (2)

Tom
Tom

Reputation: 890

SELECT count(*) 
FROM users 
WHERE createDate > curdate()

Upvotes: 1

Slava Rozhnev
Slava Rozhnev

Reputation: 10163

You just can use GROUP BY statement and get count of accounts created per date:

SELECT CreateDate, COUNT(*) as UsersCount FROM Users GROUP BY CreateDate;

Upvotes: 1

Related Questions