Connecting Tech Pros Worldwide Forums | Help | Site Map

What is the syntax for finding the Month(number) in DB2?

Newbie
 
Join Date: Nov 2008
Posts: 1
#1: Nov 3 '08
I want to compare the date today (getdate() in T-SQL) to a date in a column and subtract whole months to age a record.
Example, if the last transaction date was 9/1/2008, I want to be able to say
IF LAST_TRAN_DATE >= GETDATE() -1 THEN <DoSomething> ELSE <DontDoSomething>

In this case, I would expect <DontDoSomething> because September is less than November minus 1 (October).

How would I say this in a DB2 query?

Member
 
Join Date: Aug 2007
Posts: 51
#2: Nov 20 '08

re: What is the syntax for finding the Month(number) in DB2?


Expand|Select|Wrap|Line Numbers
  1. if Last_tran_date >= Current Date - 1 Month
Reply