Sql 按不同日期显示的postgres中的最大列值;

Sql 按不同日期显示的postgres中的最大列值;,sql,postgresql,distinct-values,Sql,Postgresql,Distinct Values,我有一个表,它有一个列名timestamp和energy,在这两列中插入数据 timestamp energy 2017-10-28 17:35:05.45144 | 40.21 2017-10-28 17:30:07.375661 | 36.21 2017-10-28 17:25:05.677181 | 36.21 2017-10-28 17:20:08.422317 | 36.21 2017-10-27 17:35:06.661

我有一个表,它有一个列名timestamp和energy,在这两列中插入数据

       timestamp               energy
 2017-10-28 17:35:05.45144  |  40.21
 2017-10-28 17:30:07.375661 |  36.21
 2017-10-28 17:25:05.677181 |  36.21
 2017-10-28 17:20:08.422317 |  36.21

 2017-10-27 17:35:06.661601 |  39.21
 2017-10-27 17:30:05.003008 |  39.19
 2017-10-27 17:25:05.251989 |  39.17
 2017-10-27 17:20:04.976132 |  39.13

 2017-10-26 17:35:06.661601 |  37.21
 2017-10-26 17:30:05.003008 |  37.19
 2017-10-26 17:25:05.251989 |  37.17
 2017-10-26 17:20:04.976132 |  37.13
等等
我想在PostgreSQL中获取每个日期的最大能量值。

提示:
分组依据
日期(trunc()
)。请回答您的问题,并根据您的样本数据添加预期输出。@GordonLinoff非常感谢您,我只花了20秒时间思考您的提示,非常感谢。这里的查询是按时间戳::日期从delta_数据组中选择timestamp::date,max(me);提示:
GROUP BY
date\u trunc()
。请回答您的问题,并根据您的样本数据添加预期的输出。@GordonLinoff非常感谢您,在您的提示后我只花了20秒时间思考,非常感谢。这里的查询是按时间戳::日期从delta_数据组中选择timestamp::date,max(me);