I am trying to create and insert statement that looks at data for a month and sums it by dept, area and month. I want to have it run automatically on the first of every month for data that is 60 days ago. How do I do that so that I get all the data for months that have 31 days?? I was going to go something like this
reporting_date >= sysdate - 60 and reporting_date <= sysdate - 30. But I don't think that will get it all. My date in the new table is going to be YYYY-MM. Is there a way to take the month out of the sysdate and then subtract 2 from that and only look at the dates that have that specific month? I'm probably not explaining myself very well so if you have any questions let me know!!
I am using an Oracle database with SQLPlus.
Any help would be GREATLY appreciated.
Thanks
reporting_date >= sysdate - 60 and reporting_date <= sysdate - 30. But I don't think that will get it all. My date in the new table is going to be YYYY-MM. Is there a way to take the month out of the sysdate and then subtract 2 from that and only look at the dates that have that specific month? I'm probably not explaining myself very well so if you have any questions let me know!!
I am using an Oracle database with SQLPlus.
Any help would be GREATLY appreciated.
Thanks