Can someone tell me how to rewrite this MySQL query with CodeIgniter's query builder ?
SELECT
question.timestamp AS question_time,
reply.timestamp AS reply_time,
(SELECT DATEDIFF(reply_time, question_time)) AS time_used_to_reply
FROM
question
JOIN
reply ON question.id = reply.question_id
WHERE
question.company_id = $company_id
After many researches, I ended up writing my own active record script.
$this->db->select(array('DATEDIFF(reply.timestamp, question.timestamp)'))
->from('question')
->join('reply', 'question.id = reply.question_id')
->where('question.company_id', $company_id);
Thanks