oracle - SQL Three Queries combined into three columns -
I have three questions which I would like to add in three columns.
I am looking for this output:
DEPTNAME1 ----- calculation (specialty_type Q1 ) ----- calculation (specific Pet_ide Q2 ) ----- calculation (specific pet_ide Q1 ) / calculation (specific pat_ide Q2 ) DEPTNAME2 ----- Calculation (specific pat_id Q1 ) ----- calculation (specialty_type Q2 ) ----- calculation (specific pet_ide Q1 < / Strong>) / calculation (specific pet_ide Q2 ) ETC My current code for Q1: My current code Q2: pre> Q3 Output / Specific Punk from Specific Line Q1 Output from Q2: Thanks for all help
select DEP.DEPARTMENT_NAME, count (count hsp .pat_id) hsp.pat_enc_csn_id left outer join Spshtta_aditi ADT from pat_enc_hsp HSPA = adt.pat_enc_csn_id ADT. On left dept.DEPARTMENT_ID = dep.DEPARTMENT_ID left on the left left hp.PAT_ID = pat.PAT_ID on the left side of the IP_flwsht_rec REC Rec.INPATIENT_DATA_ID = hsp.INPATIENT_DATA_ID l EFT on joining ip_flwsht_meas meas rec.FSD_ID = meas.FSD_ID left external meas.FLO_MEAS_ID = adt.department_id where joining ip_flo_gp_data on ip_flo_gp_data.FLO_MEAS_ID (1,2,3,4,5) and (hsp.ed_disposition_c null or HSP is .ed_disposition_c In no ('5', '6') and TO_DATE ('08 -10-2014 00:00 hsp.HOSP_ADMSN_TIME ',' DD-MM-YYYY HH24: MI: SS ') and TO_DATE ( '08 -10-2014 23:59:59 ', DEP.DEPARTMENT_NAME
select DEP.DEPARTMENT_NAME, pat_enc_hsp HSP (apart from hsp.pat_id) clarity_adt left outer join ADT hsp.pat_enc_csn_id = DEP .DEPARTMENT_ID joining count left external adt.pat_enc_csn_id clarity_dep ADT = Internal interaction on dep.DEPARTMENT_ID hsp.PAT_ID = pat.PAT_ID is empty on patient board. INPTIITIID = HSP Left external join on INPTIICTA_ID, IP_flofT_MASSIrIPIDIID = I left on IP_flwsht_meas FSDIIDIIDIDIDIDIDIDIDDIOpOfLO_MEAS_ID = ip_flo_gp_data.F LO_MEAS_ID where IN (1,2,3,4,5) adt.department_id and (hsp.ed_disposition_c is empty or not hsp.ed_disposition_c ('5', '6')) and hsp.HOSP_ADMSN_TIME TO_DATE ('08 between - 10-2014 00:00:00 ',' DD-MM-YYYYHH 24: MI: SS ') and TO_DATE ('08 -10-2014 23:59:59', 'DEP.DEPARTMENT_NAME' by GROUP 'DD-MM-YYYHH 24: MI: SS' 'and' '' 00 ',' 7 ',' 8 ',' 9 ',' 0 ') Pre>
Choose DEPARTMENT_NAME, q1, q2, decode (q2, 0, null, q1 / q2) (DEP. DEPARTMENT_NAME, count (separate hsp.pat_id) q1, count (different case when measurement .flo_meas_id ('00', '7' "8", "9", "0 in") left and no end hsp.pat_id) left outer join clarity_adt ADT on q2 hsp.pat_enc_csn_id = adt.pat_enc_csn_id from pat_enc_hsp HSP external ADT.DEPARTMENT_ID Enter clarity at -dd.DE.DEPARTMENT_ID HSP. AADIID = Patient involved in the intestine. Id rp left ip_flwsht_rec rik on INPATIENT_DATA_ID = hsp.INPATIENT_DATA_ID Exclude at External Drawing ip_flwsht_meas FSDIIID = IES Fsdiaiaiaidi ip_flo_gp_data.FLO_MEAS_ID = ip_flo_gp_data.FLO_MEAS_ID where adt.department_id IN (1,2,3 left external release IP, 4,5) and (hsp.ed_disposition_c is empty or not hsp.ed_disposition_c ( '5', '6') ) And hsp.HOSP_ADMSN_TIME TO_DATE ('08 -10-2014 between 00:00:00 ',' DD-MM-YYYY HH 24: MI: SS ') and TO_DATE ('08 -10-2014 23:59:59 ',' DD-MM-YYYYHH 24: MI: SS ') by Group DEP.DEPARTMENT_NAME);
Comments
Post a Comment