SELECT MIN(temperature)
FROM temperature
WHERE sensor_id = '28-0316387a1eff'
AND DATE(`dtg`) = CURDATE()
这样做的目的是为我显示当天的最低温度。 我怎样才能让它看到发生这种情况的时间?Mysql - 在查询结果中显示更多详细信息
列dtg
使用current_timestamp
。
谢谢。
SELECT MIN(temperature)
FROM temperature
WHERE sensor_id = '28-0316387a1eff'
AND DATE(`dtg`) = CURDATE()
这样做的目的是为我显示当天的最低温度。 我怎样才能让它看到发生这种情况的时间?Mysql - 在查询结果中显示更多详细信息
列dtg
使用current_timestamp
。
谢谢。
你可以选择该行,在温度=分钟(温度)
select `dtg`, temperature
from temperature
where temperature = (
SELECT MIN(temperature)
FROM temperature
WHERE sensor_id = '28-0316387a1eff'
AND DATE(`dtg`) = CURDATE()
)
http://dev.mysql.com/doc/refman/5.7/en/example-maximum-column-group-row.html – CBroe