Skip to content
Advertisement

Count total running events per year with events that range over multiple years

I have a table of events that span over several years.

Desired result:

I want to output the total number of “running” events for each year over the past 50 years. (In 1976, only one event was running. In 1977, the same event was still running plus another event.)

Example query:

This query returns the total for one year. What’s the best way to get this to output results for the past 50 years?

Advertisement

Answer

Basically, you need a list of years. If you don’t have one handy, you can create a list in a derived table:

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