select ms.pid, pe.eligid,ms.fname,ms.lname,ms.dob,me.coveragebegindate,
pa.programid, rf.programname,pa.workflowstatus,rfw.programworkflowstatusdesc
from pideligid pe,memberelig me, programassignment pa, membership ms,rfprogram rf, rfprogramworkflowstatus rfw
where pe.clientid=301012
and pe.pid=ms.pid
and ms.pid=me.pid
and ms.pid=pa.pid
and pa.programid=rf.programid
and me.coverageenddate is null
and me.pid not in (select pid from bcbsmi.memberelig@ingest)
--and pa.workflowstatus between 100 and 400
and pa.workflowstatus=rfw.programworkflowstatusid
order by ms.pid
|