Hello everyone!
Using DB2 8.2 vers on aix.
Really appreciate your help!
Trying to create a SP with input parms.
The first part is the SELECT statement.
(The member could change the coverage from DOHIGH to DOSTAN & other way around)
The user enters the date & BENEFIT_PLAN parameters.
The following is an expample of the data:
example of the INPUT data:
PARMS: DATE: DATE = 2005-07-01, Option: DOHIGH TO DOSTAN
????? How do I incorporate these two selects into one statement so the result will be:
Member 99999999 changed: DOHIGH on 07/01/2005 from DOSTAN on 06/30/2005
THANKS A LOT
Ann
Using DB2 8.2 vers on aix.
Really appreciate your help!
Trying to create a SP with input parms.
The first part is the SELECT statement.
(The member could change the coverage from DOHIGH to DOSTAN & other way around)
The user enters the date & BENEFIT_PLAN parameters.
The following is an expample of the data:
example of the INPUT data:
Code:
MEMBER_SSN BENEFIT_PLAN BEN_DATE END_DATE
---------- ------------ ---------- ----------
99999999 DOHIGH 07/01/2005 08/31/2005
99999999 DOSTAN 01/01/2003 06/30/2005
88888888 DOHIGH 07/01/2005 08/31/2005
88888888 DOHIGH 01/01/2003 06/30/2005
77777777 DOSTAN 07/01/2005 08/31/2005
77777777 DOHIGH 01/01/2003 06/30/2005
PARMS: DATE: DATE = 2005-07-01, Option: DOHIGH TO DOSTAN
????? How do I incorporate these two selects into one statement so the result will be:
Member 99999999 changed: DOHIGH on 07/01/2005 from DOSTAN on 06/30/2005
Code:
SELECT DISTINCT MEMBER_SSN , BENEFIT_PLAN,
date ( SUBSTR ( BEN_DATE,1,4) || '-' || SUBSTR(BEN_DATE, 5,2) || '-' || SUBSTR (BEN_DATE,7,2 ) ) AS BEGIN_DATE,
date ( SUBSTR ( END_DATE,1,4) || '-' || SUBSTR(END_DATE, 5,2) || '-' || SUBSTR (END_DATE,7,2 ) ) AS END_DATE,
from elg_summary
WHERE
(MONTH(DATE(SUBSTR(BEN_DATE,1,4) || '-' || SUBSTR(BEN_DATE, 5,2) || '-' || SUBSTR(BEN_DATE,7,2))) =
MONTH (2005-07-01))
AND
BENEFIT_PLAN = 'DOHIGH'
select DISTINCT MEMBER_SSN , BENEFIT_PLAN,
date ( SUBSTR ( BEN_DATE,1,4) || '-' || SUBSTR(BEN_DATE, 5,2) || '-' || SUBSTR (BEN_DATE,7,2 ) ) AS BEGIN_DATE,
date ( SUBSTR ( END_DATE,1,4) || '-' || SUBSTR(END_DATE, 5,2) || '-' || SUBSTR (END_DATE,7,2 ) ) AS END_DATE,
from elg_summary
WHERE
BENEFIT_PLAN = 'DOSTAN'
AND
MONTH (2005-07-01) - 1 ) =
MONTH(date(SUBSTR(END_DATE,1,4) || '-' || SUBSTR(END_DATE, 5,2) || '-' || SUBSTR (END_DATE,7,2 ))) =
THANKS A LOT
Ann