I'm working with the following SQL Query in Redash, the query retrieves monthly data from table.
SELECT *
FROM Table
WHERE
"Date" between '2021-04-01T00:00:00.669976+00:00' and '2021-04-30T23:59:59.669976+00:00'
I'd like to know if there's a workaround to updating the WHERE
clause in an efficient manner rather than manually typing it out at the end of each month.
This worked well for me:
WHERE
EXTRACT(MONTH FROM "Date") = EXTRACT(MONTH FROM CURRENT_DATE) AND EXTRACT(YEAR FROM "Date") = EXTRACT(YEAR FROM CURRENT_DATE)