Below is a where statment that I am trying to get working.
the date range is the main driver. and then the subsequent fields are what gets the detail record I need.
Where (pat.chg_date >= '06/20/2007' and pat.chg_date <= '06/22/2008'
and pat.pat_status_cn = '2'
and rx.ndc in ('00088115330', '00088115003', '68546031730')
and pat.chart_id is not NULL)
or (disp.dispense_date >= '06/20/2007' and disp.dispense_date <= '06/22/2007'
and pat.pat_status_cn = '1'
and rx.last_disp_prod like 'cop%'
and pat.chart_id is not NULL
and disp.fill_no = 1)
Start Free Trial