嗨我正在嘗試對一系列子查詢進行分組,但不斷爲每行獲得相同的結果。如何在MySQL中對多個子查詢進行分組
SELECT Campaign_Name,
(SELECT COUNT(Bounce)
FROM `temp_Data`) AS Sent, (SELECT COUNT(Bounce)
FROM `temp_Data`
WHERE Bounce = '0') AS Delivered, (SELECT SUM(Opened)
FROM `temp_Data`
WHERE Opened = '1')AS Opened
FROM temp_Data
GROUP BY Campaign_Name
結果是:
Campaign Name Sent Delivered Opened
Campaign1 300 278 196
Campaign2 300 278 196
我的數據是0.1所以,即使我總結它仍然給了我同樣的結果。
如何獲得每個廣告系列的個人計數?
更改'where子句'你不改變它。 – NEER
向我們展示您的表架構如何。 – Martin