List of Months with Years

183 views Asked by At

How can I simply get a list of months with years without a field? Kind of like how we do current_date() but instead a list of month_years to date in SQL/Big Query

1

There are 1 answers

0
Gordon Linoff On BEST ANSWER

You can unnest a date array:

select yyyymm
from unnest(generate_date_array(date '2020-01-01', '2020-12-01', interval 1 month)) yyyymm