【发布时间】:2010-05-28 06:40:15
【问题描述】:
我正在尝试计算与前两个表相关的 table3 中的所有 id,但我认为我的 SQL 代码有误,有人可以帮我修复它吗?
代码如下:
$dbc = mysqli_query($mysqli,"SELECT table1.*, table2.*, COUNT(id) as num, table3.id
FROM table1
INNER JOIN table2 ON table1.id = table2.id
INNER JOIN table3 ON table2.id = table3.id
WHERE table2.id = '$id'");
这是错误信息。
1140: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
【问题讨论】:
-
您知道,您可以发布收到的任何错误消息。或者,如果您没有收到错误,您可以发布您获得的输出和预期的输出。
标签: mysql sql mysql-error-1140