I'm very new to CodeIgniter and I have some problem converting MySQL queries to CodeIgniter. I want to update a record in one table with condition on another relational table.
Following is my MySQL query
UPDATE `user` SET `securitytoken` = '71b9b5bc1094ee6eaeae8253e787d654'
WHERE `profileid` IN (SELECT pid FROM `profile` WHERE `email` = 'firstname.lastname@example.org')
What I would do is code your query as is using
$query = $this->db->query('YOUR QUERY HERE');
and use the escape capabilities to take care of your one or two input values.
Pay attention to query bindings, may be useful in your case.
I would not try to use Active Records, your SQL is a bit too complex for that.