Hi Group,
In need to have my report bring back date from 2 date ranges:
From January 1 of this year to Today's date minus 1 day AND
From January 1 of LAST YEAR to (Today's Date - 1 day) - 12 months
I've written my SQL code as:
and a19.FULL_DATE between To_Date((SELECT TRUNC(SysDate,'YEAR') From Dual)) and To_Date((Select SysDate - 1 from Dual))
and a19.FULL_DATE between To_Date((SELECT ADD_MONTHS(TRUNC(SysDate,'YEAR'),-12) From Dual)) and To_Date((add_months(SysDate - 1), -12))
The first line appears to run correctly. However I'm getting an error on the second line. It is saying that I have a "invalid number of arguments). The "add_months" (on the second "To_Date" statement) is highlighted. Clearly I have some kind of syntax error. Can someone recommend the correct way to write this?