I am having a hard time converting my MySQL query to Codeigniter query builder. I cannot make the inner join with the same table. Like with my mySQL query. It is working on mySQL. Here is my query:
$sql = "SELECT answers.* FROM answers INNER JOIN
(SELECT * FROM
(SELECT employee_id as test_employee_id, created_on as test_created_on FROM answers) as test
GROUP BY test.test_employee_id)
AS test on (test.test_employee_id = answers.employee_id AND test.test_created_on = answers.created_on)
ORDER BY answers.created_on DESC";
Can you guys pls help me on this?? I am trying to convert it to Codeigniter query.