我正在使用自定义查询,因为 Active Record 等价物对我不起作用。
当在我的数据库软件 SQLYOG 中放置查询时它工作正常但是在 CodeIgniter 中它说
A Database Error Occurred
Error Number: 1096
No tables used
SELECT *
Filename: C:\xampp\htdocs\midas\system\database\DB_driver.php
Line Number: 330
这是我的查询:
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
这是一个有点奇怪的问题。
这也是我的架构:
最佳答案
没关系,我想通了。
对于 Codeigniter 中的自定义查询,您不能在之后使用 get 方法。
关于php - MYSQL 错误 1096 - 未使用表 - CODEIGNITER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6927940/