I have a table shown below:
login
date user
2016-11-23 1
2016-11-23 2
2016-11-23 3
2016-11-25 2
2016-11-25 5
2016-11-27 1
from the table above, what I want to get looks like this:
date count(*)
2016-11-21 0
2016-11-22 0
2016-11-23 3
2016-11-24 0
2016-11-25 2
2016-11-26 0
2016-11-27 1
But since there are only dates 2016-11-23and 2016-11-25and 2016-11-27when I request the following:
select date, count(*)
from login
where date between (current_date()-interval 7 day) and current_date()
group by date
order by date asc
He cannot get the result, like what I really want to get. Is this possible from my table login?
source
share