select a.bs_sn, a.bs_bd_no, a.bs_bk_code, a.bs_kind_no, a.bs_flag, b.det_flag, c.bp_in_no, c.bp_name, c.bp_sex, c.bp_age, c.bp_age_unit, c.bp_dept, c.bp_bed_no, d.inf_date, d.inf_type, e.sta_date, e.sta_user from bd_stock as a ) left join bd_patients…