[eluser]blitzneo[/eluser]
I have this query, and I really don't know how to change it to AR.
Any time I want to run an 'inner join' query, it adds additional fields I don't need.. but that's because I am sure I am doing something wrong.
This is the query:
$q = 'SELECT a.id as j, a.value as k
FROM a
WHERE a.id
IN (
SELECT b.aid
FROM b
WHERE b.cid = 1
)';
Any tips ? Thanks in advance!
EDIT:
I just found it -.-
$q = $this->db->select('
a.id as j,
a.value as k');
$this->db->from('a');
$this->db->where_in('a.id', 'SELECT b.aid FROM b WHERE b.cid = 1');
Anyway, can it be improved ?
Thanks ^^