I have started CodeIgniter not long ago. Can some tell me how to rewrite this query
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=someid
using the activerecord
Also any tutorial to quickly understand activerecord would be very appreciated. Thanks
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.