Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 每日最小/最大/平均SQL_Mysql - Fatal编程技术网

Mysql 每日最小/最大/平均SQL

Mysql 每日最小/最大/平均SQL,mysql,Mysql,我有一个SQL表:ID、DATETIME(时间戳)、TEMP。每天多个记录。 每天提取最小值/最大值和平均值的SELECT命令是什么? 非常感谢。您可以使用分组依据,但您需要提取日期: select date(datetime) as the_date, min(temp), max(temp), avg(temp) from t group by the_date; 你能提供一些样本数据和预期结果吗?

我有一个SQL表:ID、DATETIME(时间戳)、TEMP。每天多个记录。 每天提取最小值/最大值和平均值的SELECT命令是什么?
非常感谢。

您可以使用
分组依据
,但您需要提取日期:

select date(datetime) as the_date, min(temp), max(temp), avg(temp)
from t
group by the_date;

你能提供一些样本数据和预期结果吗?