gpt4 book ai didi

mysql查询最大重复值

转载 作者:太空宇宙 更新时间:2023-11-03 11:14:10 25 4
gpt4 key购买 nike

 b_id | s_id | doi        | dos        | charge |
+------+------+------------+------------+--------+
| 10 | 3 | 0000-00-00 | 0000-00-00 | 200 |
| 10 | 2 | 0000-00-00 | 0000-00-00 | 200 |
| 20 | 1 | 0000-00-00 | 0000-00-00 | 200 |
| 30 | 2 | 0000-00-00 | 0000-00-00 | 200 |
| 40 | 4 | 0000-00-00 | 0000-00-00 | 200 |
| 40 | 5 | 0000-00-00 | 0000-00-00 | 200 |
| 70 | 5 | 0000-00-00 | 0000-00-00 | 200 |
| 40 | 4 | 0000-00-00 | 0000-00-00 | 200 |

mysql 查询查找重复最长时间的 b_id?我试过了

select count(*) as counted from(select b_id from books) group by b_id

但它不会只返回 40...有什么办法可以从查询中得到 40

最佳答案

select b_id, count(b_id) 
from books
group by b_id
order by count(b_id) desc
limit 1;

关于mysql查询最大重复值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6404588/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com