I am using a custom query as the Active Record equivelant did not work for me.
When placing the Query in my Database Software SQLYOG it works fine however in CodeIgniter it says
A Database Error Occurred
Error Number: 1096
No tables used
SELECT *
Filename: C:\xampp\htdocs\midas\system\database\DB_driver.php
Line Number: 330
Here is my Query:
SELECT intervention.department_id, department_name, COUNT(*)
FROM intervention
LEFT JOIN department ON department.department_id = intervention.department_id
GROUP BY intervention.department_id, department.department_name
ORDER BY COUNT(*) desc
LIMIT 1
It is a bit of a strange problem.
Here is my Schema also:
http://i.imgur.com/mKNtc.png