我有這個形式的查詢:SQL多個組 - 可能嗎?
SELECT e.date, SUM(e.size) as bytes
FROM entries AS e
GROUP BY e.date
ORDER BY bytes DESC
,我有一個名爲客戶端柱,它是由靜態值(0,1,2,3),所以我希望得到這樣的:
SELECT e.date, SUM(e.size) as bytes
FROM entries AS e
WHERE e.client = 0
GROUP BY e.date
ORDER BY bytes DESC
重複爲每個客戶端類型,但在一個單一的查詢來獲取每一個客戶端類型彙總尺寸的結果:
DATE | CLI0-SIZE | CLI1-SIZE | CLI2-SIZE | CLI3-SIZE
2010-11-11 113 344 435 155
您正在使用哪個數據庫? – 2010-11-16 23:28:25