[eluser]Clooner[/eluser]
My goal is te generate this query using ActiveRecord
Code:
SELECT id
FROM (categories)
WHERE categories.id NOT IN (SELECT child from category_relations)
I am attempting this by using this code
Code:
$this->db->select("id");
$sql = "SELECT child from category_relations";
$this->db->where_not_in('categories.id',$sql);
$query = $this->db->get('categories');
if ($query->num_rows()>0)
{
return $query->result_array();
} else
return false;
But Activerecords messes it up and generates this
Code:
SELECT `id`
FROM (`categories`)
WHERE `categories`.`id` NOT IN ('SELECT child from category_relations')
Which is an entirely different query since it adds the punctuation to the select query. This makes mysql see this a a string and not an query.
I have searched the user guide on how to disable punctuation generation(it rhymes) but didn't find anything there.
How would I have to use ActiveRecord generate the top query?