Click here to Skip to main content
15,887,331 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have date in month year format as given below

3/2015
11/2016

I need to get a date which is 2 year back this date
3/2013
11/2014

I used the following code but its not generating right results
SQL
SELECT A.*,TO_DATE(A.MONTH_DATE,'MM/YYYY') FROM tmp_freq_cashin_8 A;


What I have tried:

I used the following code

<pre><pre lang="SQL">
SELECT A.*,TO_DATE(A.MONTH_DATE,'MM/YYYY') FROM tmp_freq_cashin_8 A;
Posted
Updated 7-Feb-18 9:38am

1 solution

You need to use DateAdd[^] function.
More examples here: DateADD Oracle Function — DatabaseJournal.com[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900