How to display only the lowest value from a result set (MYSQL)
P粉338969567
P粉338969567 2024-04-06 21:44:19
0
1
707

I have the following statement:

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);

It provides the following result set:

day average
date value
date value
date value
date value
date value
date value
date value

How to display only the lowest value in the result set instead of all 7 values?

P粉338969567
P粉338969567

reply all(1)
P粉790819727

You just need to use order by and 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!