简体   繁体   English

MYSQL查询以仅从当前日期选择列中的最大值

[英]MYSQL Query to Select Max Value in a Column only from Current Date

I have the following table: 我有下表:

在此处输入图片说明

I want to run a query to select the maximum value from the 'MaxWind' column but only return the result from today's date. 我想运行查询以从“ MaxWind”列中选择最大值,但仅返回今天的日期的结果。

You can probably see where I'm going here. 您可能会看到我要去的地方。 I want the maximum windspeed for the current date. 我想要当前日期的最大风速。 I would like to return what the value was and also the time it occurred. 我想返回值是什么,以及它发生的时间。

This would work for "today": 这适用于“今天”:

select max(maxwind) from weather where stamp > '2015=10=16 0:00'

For each day, you could use CURDATE: 对于每一天,您都可以使用CURDATE:

select max(maxwind) from weather where stamp >= CURDATE()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM