我想根据每天的温度值找到平均值。我怎么能这样做?
SELECT Timestamp, Value
FROM aReadings
WHERE type = 'Temperature' AND Timestamp BETWEEN ? AND ?
答案 0 :(得分:2)
尝试:
SELECT DATE(Timestamp), AVG(Value)
FROM aReadings
WHERE
type = 'Temperature'
AND Timestamp BETWEEN ? AND ?
GROUP BY DATE(Timestamp)
DATE(expr)
提取日期或日期时间表达式expr的日期部分。