问题描述
我正在使用codeigniter query-builder运行查询:
$this->db->select('t_heatpad.heatpad_status,t_heatpad.idheatpad,t_heatpad.heatpad_firstname,t_heatpad.heatpad_lastname,t_heatpad.heatpad_address,t_heatpad.heatpad_phone,t_heatpad.heatpad_doc_firstname,t_heatpad.heatpad_doc_lastname,t_heatpad.heatpad_doc_npi,t_heatpad.heatpad_doc_phone,t_heatpad.heatpad_doc_fax,t_heatpad.heatpad_med_id,t_heatpad.heatpad_data_entered,t_heatpad.heatpad_global ');
$this->db->from('t_heatpad');
$subQuery4 = $this->db->get_compiled_select();
$this->db->select('t_cgm_diabetic.cgmdiab_status,t_cgm_diabetic.idcgmdiab,t_cgm_diabetic.cgmdiab_firstname,t_cgm_diabetic.cgmdiab_lastname,t_cgm_diabetic.cgmdiab_address,t_cgm_diabetic.cgmdiab_phone,t_cgm_diabetic.cgmdiab_doc_firstname,t_cgm_diabetic.cgmdiab_doc_lastname,t_cgm_diabetic.cgmdiab_doc_npi,t_cgm_diabetic.cgmdiab_doc_phone,t_cgm_diabetic.cgmdiab_doc_fax,t_cgm_diabetic.cgmdiab_medicare,t_cgm_diabetic.cgmdiab_date_entered,t_cgm_diabetic.cgmdiab_global ');
$this->db->from('t_cgm_diabetic');
$subQuery5 = $this->db->get_compiled_select();
现在,我要在$ subQuery4和$ subQuery5上加入并集。
这种方法对我来说很好:
$this->db->query("select * from ($subQuery4 UNION $subQuery5 ) as unionTable");
但是我想用这种格式:
$this->db->select('*');
$this->db->from("($subQuery4 UNION $subQuery5 )");
$this->db->get();
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)