2
我想執行我的數據庫以下查詢: -Mysql的嵌套查詢和GROUP BY
SELECT
source, Month as t1,
GROUP_CONCAT(SELECT SUM(amount) FROM `reports` GROUP BY Month) as amount
FROM `reports`
GROUP BY source
要獲得source
,month
,並且由不同的獲得的資金總和的concatenated string
源於1個月。但是我得到一個語法錯誤。
有兩個名爲'report'和'reports'的表嗎?還是它是一個錯字? – Vatev
您正在使用有害的非標準MySQL hackstension來進行「GROUP BY」。請閱讀這個。 http://dev.mysql.com/doc/refman/5.5/en/group-by-extensions.html –
@Vatev他們是一樣的 – mega6382