Skip to content
Advertisement

Add missing monthly rows

I would like to list the missing date between two dates in a request for example

My data :

I want the request to return

i want the last 24 months from the date of execution

I did something similar with the dates but not YEAR MONTH yyyyMM

I use Cassandra database with Apache Hive connector

Can someone help me ?

Advertisement

Answer

date_range subquery generates 24 months (adjust if you want some other than 24 months range) back from current date. Left join it with your dataset, see comments in this demo code:

Result:

Use your table instead your_data subquery. Add order by if necessary.

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