How to get last month's data using presto sql
tried this :
SELECT *
FROM tabl
where my_date > cast(current_date - interval '1' month as timestamp)
But this will include current months and exclude some previous months days
How to get only last months data and current month data included like this
last month data + data until today
Use date_trunc():
where my_date < date_trunc('month', current_date) and
my_date >= date_trunc('month', current_date) - interval '1' month
If you want everything since the first day of the previous month:
where my_date >= date_trunc('month', current_date) - interval '1' month
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With