I know this easy, but my brain is still on vacation. Anyway, I have the following query:
select m.[Patient Name],
c.episode_no,
convert(varchar(10),CAST( m.DOB as DATE), 101) as DOB,
m.[Appt Date],
CONVERT(varchar(10),c.start_dtime, 101) + ' ' + CONVERT(varchar(10),c.start_dtime, 108) as DOS,
o.orgz_short_name as Entity
from Customer.MammoGramPHSFinal as m
left outer join smsmir.mir_pms_case as c
on m.[Patient Name] = REPLACE(c.rpt_name, ' ,', ', ')
and CONVERT(varchar(10),c.birth_dtime,101) = convert(varchar(10),CAST( m.DOB as DATE), 101)
Inner join smsmir.mir_orgz as o on c.src_sys_id = o.src_sys_id
where (year(c.start_dtime) = year(m.[Appt Date])
and Month(c.start_dtime) = Month(m.[Appt Date]))
o.orgz_short_name = 'BOS'
order by [Appt Date],
[Patient Name]
I need the filters but I need to show the nulls as well.
and o.orgz_short_name = 'BOS'
with
and (o.orgz_short_name = 'BOS' OR ISNULL(o.orgz_short_name, '-') = '-')