Instead of using 'case' as many times as i do?
Code:select case when b.patient_id is null then a.dfcode else b.dfcode end as dfcode, case when b.patient_id is null then a.diagcode else b.diagnosis end as diasgnosis, case when b.patient_id is null then a.times_testing else b.times_testing end as times_testing, case when b.patient_id is null then a.on_insulin else b.insulin end as insulin from event.dbo.patient_dg() a left outer join event.dbo.diabetes_rx_tracker b on a.code=b.patient_id and b.image_id='2110180' where a.code='ADSMANZS01'


Reply With Quote
Bookmarks