Hello All -
Thanks in advance for anyone who takes time to help!
I have to combined the following 2 statements
1.
2.
The first select creates a table with members who has 6 consecutive months (period) of contributions
The second select creates a table with members who has contributions in 07/01/2005 & all the rest of criteria in the statement
The final table should have only matching records from the above
For example, if 8888888 ssn have contributions in 07/01/2005, but does not have 6 consequtive month of contributions should not be on the final table
THANKS A LOT!
Thanks in advance for anyone who takes time to help!
I have to combined the following 2 statements
1.
Code:
SELECT distinct l.ssn,l.period, r.period FROM umass_contr l inner join umass_contr r on l.period = (date('2005-07-01') - 6 month) and r.period =(date('2005-07-01') - 1 month) and l.ssn = r.ssn
2.
Code:
SELECT distinct e.employer , e.period,
(case e.app when 'F' then (case e.MARIT when 'M' then 'STANDARD_FAMILY' else 'STANDARD_SINGLE' end) else '' end) plandesc,
e.ssn, e.app, e.marit
FROM umass_contr e
WHERE
employer='9990001'
and e.ssn='019249046' and
e.period = date('2005-07-01')
and e.APP IN ('F' )
and e.ssn not in ( select distinct ssn from umass_contr where app in ('SFHS','SFHF') and period = date('2005-07-01') )
-- and l.ssn not in ( select distinct ssn from umass_contr where nk_type='NK' and period = date('2005-07-01') )
The first select creates a table with members who has 6 consecutive months (period) of contributions
The second select creates a table with members who has contributions in 07/01/2005 & all the rest of criteria in the statement
The final table should have only matching records from the above
For example, if 8888888 ssn have contributions in 07/01/2005, but does not have 6 consequtive month of contributions should not be on the final table
THANKS A LOT!