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
- 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
我想选择出版过的出版物中最经常出现的地方。这可能吗?提前谢谢院长
1 个解决方案
#1
3
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.
你不需要计数,但是如果你想确认这个选择是合理的,你可以使用它。同样,您也没有明确地说您是否只想要一个记录,或者想看看哪个记录的频率是最频繁的,以及其他记录的频率。如果您想查看所有记录,请去掉限制1。
#1
3
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.
你不需要计数,但是如果你想确认这个选择是合理的,你可以使用它。同样,您也没有明确地说您是否只想要一个记录,或者想看看哪个记录的频率是最频繁的,以及其他记录的频率。如果您想查看所有记录,请去掉限制1。