function to subtract 200 days from date

0 pts.
Tags:
Data warehousing/Business intelligence
Database Management Systems
DB2
Development
MySQL
Software testing
I need to write the filter condition in cognos as follows: YRMOSDOS between (&YRMOSDOS - 200) AND (&YRMOSDOS) where YRMOSDOS is in date form. How do I achieve it? The database is in db2. Decimal function does not work. Please help. Thanks a lot.
ASKED: June 24, 2005  11:20 AM
UPDATED: June 29, 2005  7:51 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I think you need to cast the field to a date and use the DAYS keyword on the number of days… i.e.:

WHERE &YRMOSDOS between (DATE(&YRMOSDOS) – 200 DAYS) AND (DATE(&YRMOSDOS))

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Howard2nd
    Anytime I have date math I convert to Julian Date. Simple math, easy to work with, and in most languages a faster convert to/from than casting system date to variable. Good luck. p.s. Of course I have a roman numeral calculator also.
    30 pointsBadges:
    report
  • Jvoteur
    Couple of quick questions, what version of DB2 are you using? what development environment are you using? and what is the error message you get? If it is a parsing error then you probably aren't dealing with just a date format issue at this point.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following