I want to be able to return 0 when I do the count, I would prefer not to use joins, since my query doesn't use them.
This is my request.
SELECT count( user_id ) as agencyLogins,
DATE_FORMAT(login_date, '%Y-%m-%d') as date
FROM logins, users
WHERE login_date >= '2015-02-10%' AND login_date < '2016-02-11%'
AND logins.user_id = users.id
GROUP BY DATE_FORMAT(login_date,'%Y-%m-%d')
What he does is the number of times a user visits the site. It does not account for zeros, though, where I want to know when there were no entries in the log.
source
share