Reputation: 29655
I am creating a histogram of dates using SQL and I want to have "0" values for the missing dates. The specific SQL system I'm using is Google Sheets. Here is my example:
What I really want is for it to look like this:
Is there any way to do this?
The query that I'm using is SELECT a,COUNT(a) GROUP BY a ORDER BY a
.
Is there a way to do what I want?
Upvotes: 0
Views: 500
Reputation: 1269823
Create a column of the dates you want. For instance, you can put in the first date, the right below it have a formula that adds one day, and copy the formula down.
Then, use COUNTIF
or a similar function to get the counts you want, e.g.:
=COUNTIF($A$1:$A:$5,"=" & C2)
Upvotes: 3