strike_noir strike_noir - 1 year ago 114
MySQL Question

UNION query with codeigniter's active record pattern

How to do UNION query with PHP CodeIgniter framework's active record query format?

Answer Source

CodeIgniter's ActiveRecord doesn't support UNION, so you would just write your query and use the ActiveRecord's query method.

$this->db->query('SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download