Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month relative

Status
Not open for further replies.

ShortyA

MIS
Feb 20, 2002
363
CH
Hi there,
I am trying to write a script that extracts data where a date field contains a value that is from the last full month.

Does anyone have any guidance on the syntax ?
Thanks very much,
Alec
 
Alec,

How about:

Select * from mytable where month(mydate) = month(current date - 1 MONTH)

HTH

Andy
 
Is this what you are looking for :

values(current date - day(current date) days +1 day - 1 month)

1
----------
04/01/2003

1 record(s) selected.


values (current date - day(current date) days )

1
----------
04/30/2003

1 record(s) selected.

More DB2 questions answered at
 
Thanks for your help. I used the suggestion from ARWinner and it was exactly what I needed.

Alec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top