2
我有一張表格,裏面填寫了銷售汽車的數據。MySQL數據彙總平均值失敗
我想得到每日平均數,所以我使用聚合和下面的函數。
SELECT
DAYOFMONTH(TIMESTAMP) AS DAY,
MONTH(TIMESTAMP) AS MONTH,
AVG(number_sold) AS sold,
AVG(amount_earned) AS earned,
AVG(wages_spent) AS wages
FROM cardata
GROUP BY DAYOFMONTH(TIMESTAMP)
ORDER BY TIMESTAMP DESC
LIMIT 0, 12;
我應該得到12行,每天有1行。 12行返回,但每天都會出現問題。 2月份我只獲得第5天和第8天。
我的陳述有問題嗎?
請幫忙嗎?
嘿感謝團體修復它,沒有意識到我可以做到這一點 –