vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| "Corky" <mowere@konicabt.com> wrote in message news:7e5571df.0312031235.122888c5@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. |
| |||
| "Serge Rielau" <srielau@ca.eye-bee-m.com> wrote in message news:bqltme$jij$2@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? |
| ||||
| Mark A <ma@switchboard.net> wrote: > "Serge Rielau" <srielau@ca.eye-bee-m.com> wrote in message > news:bqltme$jij$2@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 |