我有一张表格,里面装满了售出汽车的数据。
我想获得每日平均值,所以我正在使用聚合和以下函数。
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 天。
我的陈述有问题吗?
请帮忙?