Any help is appreciated!
I need to select records with END_DATE of previous month.
How do I account for January ?
THANKS A LOT,
Ann
I need to select records with END_DATE of previous month.
How do I account for January ?
Code:
SELECT DISTINCT
HIGH.MEMBER_SSN
, HIGH.BENEFIT_PLAN
, HIGH.BEN_DATE AS BEGIN_DATE
, HIGH.END_DATE AS HIGH_END_DATE
, STD.BENEFIT_PLAN
, STD.BEN_DATE AS STD_BEGIN_DATE
, STD.END_DATE AS STD_END_DATE
FROM ELG_SUMMARY HIGH INNER JOIN ELG_SUMMARY STD ON STD.MEMBER_SSN = HIGH.MEMBER_SSN
WHERE
(
MONTH ( DATE ( HIGH.BEN_DATE ) ) = MONTH ('2005-07-01')
AND HIGH.BENEFIT_PLAN = 'DOHIGH'
)
AND
(
MONTH (DATE ( STD.END_DATE) ) = [COLOR=red][b]MONTH (DATE( '2005-07-01') ) - 01 [/b][/color red]
AND STD.BENEFIT_PLAN = 'DOSTAN'
)
THANKS A LOT,
Ann