-1
使用我司希望得到普及制訂總的意見/圖片數量: 這是代碼:遇到問題在MySQL
$users = DB::query("SELECT * ,
COUNT(p.id) as numPics,
SUM(p.views) as totalViews
COUNT(p.views)/SUM(p.id) as popularity
FROM
images p
INNER JOIN
users u
ON
p.user_id = u.id
WHERE
p.created_at >= \"$current_month\"
GROUP BY p.user_id
ORDER BY popularity DESC LIMIT 10");
我得到這個錯誤: 語法錯誤或訪問衝突: 1064你的SQL語法有錯誤;檢查對應於你的MySQL服務器版本使用附近的「COUNT(p.views)/ SUM(p.id)爲普及正確的語法手冊
'totalViews'後面缺少逗號 – andrewsi 2013-04-29 15:14:17