dbTalk Databases Forums  

return last month

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss return last month in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jobs
 
Posts: n/a

Default return last month - 11-08-2007 , 04:41 PM






sorry to have to ask this.

How do I return last month in mm format?

For example it's November 8th Today. I'd like to get 10 back. If it
were January 8th, i'd like to get 12 back.

Thanks.


Reply With Quote
  #2  
Old   
Terry Dykstra
 
Posts: n/a

Default Re: return last month - 11-08-2007 , 05:02 PM






"jobs" <jobs (AT) webdos (DOT) com> wrote

Quote:
sorry to have to ask this.

How do I return last month in mm format?

For example it's November 8th Today. I'd like to get 10 back. If it
were January 8th, i'd like to get 12 back.

Thanks.

Take a look at the add_months() function, e.g.:
select to_char(add_months(sysdate,-1),'mm') from dual
--
Terry Dykstra




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.