0
我正在嘗試計算所有與前兩個表相關的表3的IDS,但我認爲我的SQL代碼是錯誤的,有人能幫我修復它嗎?MySQL彙總錯誤
下面是代碼:
$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
你知道,你可以發佈你得到的任何錯誤消息。或者如果你沒有收到錯誤,你可以發佈你得到的輸出和預期的輸出。 – 2010-05-28 06:43:13