如何从结果集中仅显示最低值(MYSQL)
P粉338969567
P粉338969567 2024-04-06 21:44:19
0
1
756

我有以下声明:

select DATE(recieved_on) as Day, round (count(*) / 24)  AS 'average'
from message
where facility in ('FACID')
AND received on BETWEEN '2022-05-29 00:00:00' AND '2022-06-04 23:59:59'
GROUP BY DATE(received on);

它提供了以下结果集:

平均
日期
日期
日期
日期
日期
日期
日期

如何仅显示结果集中的最低值而不是全部 7 个值?

P粉338969567
P粉338969567

全部回复(1)
P粉790819727

您只需使用 order by 和 limit 即可:

select DATE(recieved_on) as Day, round (count(*) / 24) AS 'average'
from message
where facility in ('FACID') AND received on BETWEEN '2022-05-29 00:00:00' AND '2022-06-04 23:59:59'
GROUP BY DATE(received on)
order by average
limit 1
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板