google cloud platform – Bigquery – Exclude Current Month rows in a table
Can I please get some help with excluding current month data only
I am using the below code but it excludes the same month from previous years as well.
Example: I would like all rows for the current month Feb-23 to be excluded but the below code is excluding Feb-23, Feb-22, Feb-21 etc as well.
SELECT * FROM TaBLE WHERE
EXTRACT(YEAR FROM CalendarMonth) != EXTRACT(YEAR FROM CURRENT_DATE()) AND
EXTRACT(MONTH FROM CalendarMonth) != EXTRACT(MONTH FROM CURRENT_DATE())
Read more here: Source link