Given two @START_DATE
and @END_DATE
parameters, I'd like to write a query that generates pairs of (month_start_date, month_end_date) for every month that exists between those two days, including the ones those dates are in.
E.g. If @START_DATE = '2018-01-14'
and @END_DATE = '2018-05-04'
(yyyy-MM-dd), I'd like the output to be
month_start_date, month_end_date
2018-01-01, 2018-01-31
2018-02-01, 2018-02-28
2018-03-01, 2018-03-31
2018-04-01, 2018-04-30
2018-05-01, 2018-05-31