Hello all -
How do I add the condition to look for Quarter 3 earn in case if the 4th Quarter earn is null (WORK_PERIOD is char 200501….).
Here is my select for Q4 only:
Thanks,
Cristi.
How do I add the condition to look for Quarter 3 earn in case if the 4th Quarter earn is null (WORK_PERIOD is char 200501….).
Here is my select for Q4 only:
Code:
SELECT
MEMBER_WORK_PERIOD.MEMBER_KEY
, MEMBER_WORK_PERIOD.EMPLOYER_NO
, SUM ( CASE WHEN WORK_PERIOD IN ( '200510','200511','200512')
and funds_05.fund NOT in ('DFH','CAH','66LH','L108H','TOGH')
THEN QUANTITY END) AS Q4_EARN
, SUM ( CASE WHEN WORK_PERIOD IN ( '200510','200511','200512') and funds_05.fund in
('DFH','CAH','66LH','L108H','TOGH') THEN (cast (RATE as float)) END ) AS Q4_FLAT_EARN
, MEMBER_WORK_PERIOD_FUND.APP
, MEMBER_WORK_PERIOD_FUND.FUND
FROM
MEMBER_WORK_PERIOD_FUND
, MEMBER_WORK_PERIOD
, FUNDS_05
WHERE MEMBER_WORK_PERIOD_FUND.MVPOS=MEMBER_WORK_PERIOD.MVPOS
AND MEMBER_WORK_PERIOD.MEMBER_KEY=MEMBER_WORK_PERIOD_FUND.MEMBER_KEY
AND
MEMBER_WORK_PERIOD_FUND.FUND = FUNDS_05.fund
and fund_desc='H'
and WORK_PERIOD ( '200510','200511','200512')
[red]---?????( '200507','200508','200509') ???? [/red]
GROUP BY
MEMBER_WORK_PERIOD.EMPLOYER_NO
, MEMBER_WORK_PERIOD.MEMBER_KEY
, MEMBER_WORK_PERIOD_FUND.APP
, MEMBER_WORK_PERIOD_FUND.FUND
Cristi.