View previous topic :: View next topic
|
Author |
Message |
tanguduk Warnings : 1 New User
Joined: 29 Aug 2005 Posts: 14
|
|
|
|
Hi ,
I have start date in one table and year in one table i have to compare year (min(startdate) > year in other table . Please let me know how can i compare this .
this is my query
Code: |
SELECT A.EMP_NR,A.LT_SS_PE_DTE,
MAX(B.PH_STRT_DTE),B.PH_END_DTE,B.PH_PEP_TYP,
B.PH_PAS_PLN_NR,A.LT_BIS_YEAR FROM
AAPROD.PASR230A_LIFETIME A,
AAPROD.PASR240A_PEPHIST B WHERE A.EMP_NR= B.EMP_NR AND
--ELECT MIN(C.PH_STRT_DTE) FROM
--APROD.PASR240A_PEPHIST C WHERE A.EMP_NR= C.EMP_NR AND
B.PH_PEP_TYP ='I' AND
B.PH_PAS_PLN_NR IN (90,94,95) GROUP BY A.EMP_NR,A.LT_SS_PE_DTE,
B.PH_STRT_DTE,B.PH_END_DTE,B.PH_PEP_TYP, B.PH_PAS_PLN_NR,A.LT_BIS_YEAR
HAVING A.LT_SS_PE_DTE < MIN(B.PH_STRT_DTE) AND
(YEAR(MIN(B.PH_STRT_DTE)) > A.LT_BIS_YEAR) AND
((DAYS (A.LT_SS_PE_DTE) - DAYS(MIN(B.PH_STRT_DTE)) > 28) OR
(DAYS (A.LT_SS_PE_DTE) - DAYS(MIN(B.PH_STRT_DTE)) <= -28)); |
When I compare I am getting error
SQLCODE = -401, ERROR: THE OPERANDS OF AN ARITHMETIC OR COMPARISON
OPERATION ARE NOT COMPARABLE
Please suggest me .. |
|
Back to top |
|
|
anandinmainframe
Active User
Joined: 31 May 2007 Posts: 171 Location: India
|
|
|
|
kiran kumar,
This is the problem i believe
Code: |
(DAYS (A.LT_SS_PE_DTE) - DAYS(MIN(B.PH_STRT_DTE)) <= -28));
|
please remove the commented lines before you post and use code tags. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you clone the query to the bare minimum needed to test the date comparison. If that does not work, post the small query (using the "Code" tag) along with the diagnostic info. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Code: |
(YEAR(MIN(B.PH_STRT_DTE)) > A.LT_BIS_YEAR) |
YEAR(MIN(B.PH_STRT_DTE) would be an large integer what is the definition of A.LT_BIS_YEAR? |
|
Back to top |
|
|
|