I talk a little about activation and manual queries in Codeigniter. ActiveRecord is awesome when it comes to standard queries and takes very little development time.
However, when there is a need to add some complexity to queries, ActiveRecord gets complicated to work with. Sub-queries or complex joins give me more headaches.
Since the current query "$ this-> db-> query" immediately executes the given query, it cannot be combined with regular activeRecord calls.
So what can I do to combine the two methods?
An example of what I want to accomplish:
$this->db->select('title, content, date'); $this->db->from('mytable'); $this->db->manual('UNION'); // My own idea of db-call that appends UNION to the query $this->db->select('title, content, date'); $this->db->from('mytable2'); $query = $this->db->get();
Thanks!
source share