Я пытаюсь составить союз в Codeigniter. Я нашел этот скелет кода в другом месте: < /p>
$this->db->select('title, content, date');
$this->db->from('mytable');
$query = $this->db->get();
$subQuery1 = $this->db->_compile_select();
$this->db->_reset_select();
// #2 SubQueries no.2 -------------------------------------------
$this->db->select('title, content, date');
$this->db->from('mytable2');
$query = $this->db->get();
$subQuery2 = $this->db->_compile_select();
$this->db->_reset_select();
// #3 Union with Simple Manual Queries --------------------------
$this->db->query("select * from ($subQuery1 UNION $subQuery2) as unionTable");
// #3 (alternative) Union with another Active Record ------------
$this->db->from("($subQuery1 UNION $subQuery2)");
$this->db->get();
< /code>
Что меня сбивает с толку, это скажем, что у вас есть пункт get_where в вашем исходном подпрограмме, как вы включите это? Что -то вроде этого: < /p>
запрос 1 < /p>
$this->db->select('Id,title, content, date');
$this->db->from('mytable');
$query = $this->db->get_where('Boo', array('Id' => $foo['foo_Id']);
$subQuery1 = $this->db->_compile_select();
< /code>
Query 2 < /p>
$this->db->select('title, content, date');
$this->db->from('mytable2');
$query = $this->db->get_where('Boo', array('Title' => $foo['foo_Title'])
$subQuery2 = $this->db->_compile_select();
< /code>
Спасибо. < /p>
Подробнее здесь: https://stackoverflow.com/questions/100 ... -framework