Firstly it's been a very long time since I did any SQL and even then it wasn't at a high level.
I have created a SQL query which works but I want it so the date range changes automatically, for example to run for the previous month. I have struggled for hours but cant seem to get any type of variable to work.
Here is the simple SQL I have created.
SELECT DEST, COUNT (DEST), SUM(TALK_TIME), SUM(HOLD_TIME)
FROM ACC.CALLDETAIL a
where a.ORIG_DATE>='1140201'
and a.ORIG_DATE<'1140301'
and a.APPLIC_NUM = 185
GROUP BY a.DEST;
The date format is strange, its years after 1900 month day
Any help will be appreciated.