I am looking for a way to get the start and end datetime for the previous month the query is run that I can reuse inside a query.
I was looking at interval
but I would like the query to work out that if I run the query in March 2021 that I am looking for data from '2021-02-01 00:00:00' to '2021-02-28 23:59:59'.
Is this possible using interval
or something similar or does it need an intermediate step?
timestamp
column in the table that you want to compare?