简体   繁体   English

如何获取每天(指定时间段内)温度最高的注册ID?

[英]How can I take the ids of the registrations with the highest temperature of each day (on a specified period of time)?

Considering I have more than 30 registers/day for that temperature. 考虑到我每天有超过30个寄存器用于该温度。

  • Name of the table: 'temperatures' 表格名称:“温度”
  • Colomn name: 'TempA' 栏名称:“ TempA”

I want one registration for each day, for example: 我想每天进行一次注册,例如:

date: 2015-12-10 12:02 id: 2341 tempa: 54 (which is the highest on that day)
date: 2015-12-09 15:04 id 1923 tempa: 32 (which is the highest on that day)

and so on.... 等等....

您可以使用max和group by

select max(TempA) from your_table group by day_column
select id from temperatures where TempA=(select max(TempA) from temperatures )

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

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