So implementieren Sie „UNION“ mit zwei Abfragen, die mit get_compiled_select() von CodeIgniter gerendert wurden [DuplikaPhp

PHP-Programmierer chatten hier
Anonymous
 So implementieren Sie „UNION“ mit zwei Abfragen, die mit get_compiled_select() von CodeIgniter gerendert wurden [Duplika

Post by Anonymous »

Ich führe eine Abfrage mit dem Abfrage-Builder von CodeIgniter aus:

Code: Select all

   $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();
Jetzt möchte ich Union auf $subQuery4 und $subQuery5 setzen.

Diese Methode funktioniert für mich gut:

Code: Select all

$this->db->query("select * from ($subQuery4 UNION $subQuery5 ) as unionTable");
Aber ich möchte das in diesem Format machen:

Code: Select all

 $this->db->select('*');
$this->db->from("($subQuery4 UNION $subQuery5 )");
$this->db->get();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post