Lets say I have a mysql table called 'signups
' with the following values:
Name Signup Date
dog 2008-05-14 18:53:30
cat 2008-05-14 12:13:20
mouse 2008-05-14 08:51:32
giraffe 2008-05-15 22:13:31
Moose 2008-05-16 13:20:30
monkey 2008-05-16 08:51:32
mongoose 2008-05-16 22:13:31
fish 2008-05-16 13:00:30
I want to generate a report for how many animals signed up for each DAY (I don't care about the time of day). So the end result of what I'm looking for from the above example table is:
Date Signups
2008-05-14 3
2008-05-15 1
2008-05-16 4
Is there a way to do this in mysql, or do I need to involve another language like PHP to calculate totals?
Any ideas are appreciated, thanks
SELECT DATE(Signup_Date) AS `Date`
, COUNT(*) AS Signups
FROM `signups`
GROUP BY
DATE(Signup_Date)
will give you exactly what you're after.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With