Hello,
I'm searching data like:
"Date" between "current_month-1" and "current_month+6"
where Date= 1.2.2017
I'm using below query for condition:
select to_char( ADD_MONTHS( sysdate, -1 ) ,'MM-YYYY') from dual; // for last month data
select to_char( ADD_MONTHS( sysdate, 6 ) ,'MM-YYYY') from dual; // for current +6 months data
so final condition like:
to_char(date,'MM-YYYY') between to_char( ADD_MONTHS( sysdate, -1 ) ,'MM-YYYY') and to_char( ADD_MONTHS( sysdate, 6 ) ,'MM-YYYY')
but the above condition is not working, please help me to correct above condition.
Thanks in advance
[Updated on: Wed, 09 November 2016 04:54]
Report message to a moderator