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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can you select date-1 (or date-3) in a DB2 SELECT

Status
Not open for further replies.

colezpapa3

Programmer
Dec 8, 2007
73
US
I need to query on a date value (last activity date value). The value is will normally be date-1, and date-3 on a Monday. How can I do it in a DB2 select.
I tried the following but it does not work....

DATE_DT = Case dayofweek(current date) When 2 Then current date - 3 day else current date - 1 day End
 
Code:
CASE WHEN dayofweek(current date)=2 
then current date - 3 days
else current date - 1 days
end

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top