Skip to content

Instantly share code, notes, and snippets.

@jthandy
Created April 6, 2016 15:31
Show Gist options
  • Save jthandy/8c784293b938b52c75988d5dfbc4dce5 to your computer and use it in GitHub Desktop.
Save jthandy/8c784293b938b52c75988d5dfbc4dce5 to your computer and use it in GitHub Desktop.
days as (
select (min(period_start) over () + row_number() over ())::date as date_day
from invoices
), months as (
select distinct date_trunc('month', date_day)::date as date_month
from days
where date_day <= current_date
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment