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

DATE function problems

P: n/a
This works:

db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS
INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID =
PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -
DAYS(PROBLEMS.CLOSE_DATE)) = 365 AND PROBLEMS.CLOSE_DATE IS NOT NULL

But this doesn't:

db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS
INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID =
PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -
DAYS(PROBLEMS.CLOSE_DATE)) > 365 AND PROBLEMS.CLOSE_DATE IS NOT NULL

The only difference is the comparison operator ( = vs. > )

Any ideas?

Thanks in advance,

Corky
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Corky" <mo****@konicabt.com> wrote in message
news:7e**************************@posting.google.c om...
This works:

db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS
INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID =
PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -
DAYS(PROBLEMS.CLOSE_DATE)) = 365 AND PROBLEMS.CLOSE_DATE IS NOT NULL

But this doesn't:

db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS
INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID =
PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -
DAYS(PROBLEMS.CLOSE_DATE)) > 365 AND PROBLEMS.CLOSE_DATE IS NOT NULL

The only difference is the comparison operator ( = vs. > )

Any ideas?

Thanks in advance,

Corky


I don't know the answer to your question, but I don't understand why you are
using the integer function since the days function returns the value in
integer format.

When you say "does not work." Does that mean you get an error or no data
returned.
Nov 12 '05 #2

P: n/a
You working on some Mars-Probe? On Earth 365 is pretty much all you get
in a year....

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #3

P: n/a
"Serge Rielau" <sr*****@ca.eye-bee-m.com> wrote in message
news:bq**********@hanover.torolab.ibm.com...
You working on some Mars-Probe? On Earth 365 is pretty much all you get
in a year....

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

What about leap years?
Nov 12 '05 #4

P: n/a
Hmmm, I just had this one backfire on me, eh?
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab

Nov 12 '05 #5

P: n/a
Mark A <ma@switchboard.net> wrote:
"Serge Rielau" <sr*****@ca.eye-bee-m.com> wrote in message
news:bq**********@hanover.torolab.ibm.com...
You working on some Mars-Probe? On Earth 365 is pretty much all you get
in a year....

What about leap years?


And don't forget that there is more than just one year...

Anyway, what is the exact error message that is returned by DB2 on the "not
working" query?

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.