Home » SQL & PL/SQL » SQL & PL/SQL » How to fetch last five year data (Oracle 11g)
How to fetch last five year data [message #623366] Tue, 09 September 2014 05:33 Go to next message
na.dharma@gmail.com
Messages: 82
Registered: May 2008
Location: bangalore
Member

How to fetch last five year data, staring from now, restriction I should now use between condition.

We have close of business key like 2014, 2013

Select * from d_close_of_business
Order by close_of_business_key desc

1220140430 2345 M Monthly
1220140331 2320 M Monthly
1220140228 2299 M Monthly
1220140131 2278 M Monthly
1220131231 2245 M Monthly
1220131129 2223 M Monthly
Re: How to fetch last five year data [message #623369 is a reply to message #623366] Tue, 09 September 2014 06:34 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

date_col >= add_months(sysdate,-5*12)

Re: How to fetch last five year data [message #623377 is a reply to message #623366] Tue, 09 September 2014 07:59 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
https://community.oracle.com/thread/3605805
Re: How to fetch last five year data [message #623385 is a reply to message #623366] Tue, 09 September 2014 09:21 Go to previous message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
After 6 years being registered with OraFAQ, this is such a poor way of posting a question. Also, it has been told to you to follow posting guidelines multiple times. Alas! You still don't follow it. I am just contemplating how do you manage to follow IT standards at work.
Previous Topic: Time based alerting
Next Topic: RPAD problem
Goto Forum:
  


Current Time: Fri Mar 29 10:46:03 CDT 2024