4,707 questions
I think is what you might be looking for. But note that since I don't have your tables, it is a bit of a guessing game:
select (p.patient_name) 'Dogs Name',
(rq.print_note) 'Vial #',
(rq.collect_date) 'Collect Date',
r."Cortisol (ug/dL)", r."Creatinine (mg/dL)", r."UC:Cr (Ratio)"
from (select req_panel_id,
min(case when panel_test_id = '1196' then result end) AS "Cortisol (ug/dL)",
min(case when panel_test_id = '1197' then result end) AS "Creatinine (mg/dL)",
min(case when panel_test_id = '1195' then result end) AS "UC:Cr (Ratio)"
from result
Where panel_test_id in ('1196','1197','1195')
group by req_panel_id) as r
left join req_panel rp
on r.req_panel_id = rp.req_panel_id
left join requisition rq
on rp.requisition_id = rq.requisition_id
left join vw_patient p
on rq.patient_eid = p.patient_eid
ORDER BY "Collect Date"