Skip to content

Adding SQL Rows from two CTEs

I have two CTEs that I’ve unioned two produce the following result:

I want to add the events per day together so that

At the moment I have something like:

If I want a third set of results being the sum, I assume I need to do something like

But that’s clearly not correct. What am I missing?

Advertisement

Answer

Just group by, as below:

User contributions licensed under: CC BY-SA
10 People found this is helpful