简体   繁体   English

从列中选择最常用的

[英]Select most frequent from column in

Hi 你好
i have a columm in the table and i want to select the most common item from the selected column. 我在表格中有一个columm,我想从所选列中选择最常见的项目。 The table is set up publication: 该表已设置发布:

  • id 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

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. 如果要查看所有记录,请取消limit 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM