I have a question about extract function in PostgreSQL.
I am generating reports about last month's data.
So far no problem:
where extract (month from date) = extract(month from current_date- '1 month'::interval)
But the problem with this setup is that when the data spans more than 1 year than more months will be included.
To handle this I can add another condition for year:
and extract (year from date) = extract (year from current_date)
But this will cause a problem when generating report about December in January.
How can I generate my report about December in January without the fear that I include more months.
is_previous_month booleanin our time dimension.