I have users
table. I would like to generate a report of user who joined for that day.
Problem is, my DateJoined
field is a timestamp
field,
As the query is following as:
SELECT COUNT(UserID) AS TOT FROM users GROUP BY DateJoined
does not work, how do I get it to GROUP BY
just the date part and not the time of DateJoined
field?
your code:
SELECT
COUNT(UserID) AS TOT
FROM users
GROUP BY DateJoined
you should change like as:
SELECT
DATE(DateJoined),
COUNT(UserID) AS TOT
FROM users
GROUP BY DATE(DateJoined)
the sqlfiddle
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