1
需要合併postgres中的兩個select查詢結果與out使用union或union所有bcz數據類型都不同。我可以在php中執行它,但仍然試圖獲取查詢結果本身。合併postgres中的兩個select查詢結果
我試圖與工會它說數據類型是不同的
查詢1:
(select a.id,a.op_id,a.consult_id,b.id,b.finding_value,b.test_name_id,b.methd_id,b.sngl_tst_id,b.grp_tst_id,b.cmplx_tst_rslt_id,b.test_type
from tra_rslt_entry_hd a
join tra_rslt_entry_dt b on b.result_id = a.id
where b.test_type = 'S' and a.consult_id = 5849)
QUERY 2:
(select distinct a.op_id,a.consult_id,d.test_name_id,d.specimen,max(g.male)as male,max(g.female) as female,max(g.common) as common ,max(g.adult) as adult,max(g.child) as child,max(g.gender_specific)as gender_specific, d.test_name
from tra_op_ip_consult_head a
join tra_op_ip_diagno_detail c on c.consult_id=a.consult_id
join mas_test_name d on d.test_name_id = c.test_name_id
join mas_tst_rgnt_nmval g on g.test_name_id = d.test_name_id
where a.consult_id =5849 and d.dept_id = 6 group by a.consult_id,a.op_id,d.test_name_id,d.test_name,d.specimen
order by d.test_name_id)