从列中选择最常用的(Select most frequent from column in)

编程入门 行业动态 更新时间:2024-10-28 16:29:25
从列中选择最常用的(Select most frequent from column in)

你好 我在表格中有一个columm,我想从所选列中选择最常用的项目。 该表已设置发布:

ID 标题 发表

我希望能够选择出版物已经出版的最经常出现的地方。 这可能吗? 提前致谢 院长

Hi i have a columm in the table and i want to select the most common item from the selected column. The table is set up publication:

id Title published

I want to beable to select the most recurring places where publications have been published. Is this possible to do? Thanks in Advance Dean

最满意答案

select published, count(*) nbr from table1 group by published order by nbr desc limit 1

你真的不需要计算,但如果你想确认选择似乎合理,你可以使用它。 此外,您没有具体说明您是否只想要一个,或者想要查看哪个是最频繁的,以及其他记录的频率。 如果要查看所有记录,请取消limit 1 。

select published, count(*) nbr from table1 group by published order by nbr desc limit 1

You don't really need the count, but if you wanted confirmation that the choice seemed reasonable, you could use it. Also, you didn't specifically say whether you wanted ONLY the one, or wanted to see which was the most frequent, along with frequencies of the other records. Take off the limit 1 if you want to see all records.

更多推荐

本文发布于:2023-04-29 04:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335074.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最常用   Select   column   frequent

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!