By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,585 Members | 2,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,585 IT Pros & Developers. It's quick & easy.

Days/date redux UDB DB2 8.1.5 Linux

P: n/a
I have a column which is the relative day number to give a treatment on.
For a particular patient, where I know the starting date, how do I show
the actual date for each relative day? the best I can see is:

SELECT ..., DATE(DAYS(start_date)+relative_days-1), ...

Is that the best/preferred method for this problem?
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Bob Stearns" <rs**********@charter.net> wrote in message
news:WC****************@fe03.lga...
I have a column which is the relative day number to give a treatment on.
For a particular patient, where I know the starting date, how do I show the
actual date for each relative day? the best I can see is:

SELECT ..., DATE(DAYS(start_date)+relative_days-1), ...

Is that the best/preferred method for this problem?


SELECT start_date + relative_days days - 1 days from patient_table where
....

I assume you want one day less than the relative_days.
Nov 12 '05 #2

P: n/a
Mark A wrote:
"Bob Stearns" <rs**********@charter.net> wrote in message
news:WC****************@fe03.lga...
I have a column which is the relative day number to give a treatment on.
For a particular patient, where I know the starting date, how do I show the
actual date for each relative day? the best I can see is:

SELECT ..., DATE(DAYS(start_date)+relative_days-1), ...

Is that the best/preferred method for this problem?

SELECT start_date + relative_days days - 1 days from patient_table where
...

I assume you want one day less than the relative_days.

Is that valid syntax when relative_days is in the database? I wasn't
sure of that.

I don't know if the user uses base 0 or base 1 relative days; i.e. is
the first day 0 or 1. I'm trying to find out, but am currently presuming
first=1.
Nov 12 '05 #3

P: n/a
"Bob Stearns" <rs**********@charter.net> wrote in message
news:f0*******************@fe05.lga...
Is that valid syntax when relative_days is in the database? I wasn't sure
of that.

I don't know if the user uses base 0 or base 1 relative days; i.e. is the
first day 0 or 1. I'm trying to find out, but am currently presuming
first=1.


That is valid syntax if relative_days is column in the table or variable in
the program. Obviously, a numeric literal can be used also.

Whether or not you subtract one day has nothing to do with DB2 syntax, so I
will leave that up to you to figure out.
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.