如何显示MySQL中最常见的值序列?
假设我有一张这样的桌子。
A | B
-----
1 | 4
7 | 8
1 | 3
1 | 2
4 | 5
3 | 5
2 | 5
7 | 8
尽管 1
是 A
列中最常见的值,而 5
是 B
列中最常见的值(可以使用 COUNT()
非常简单地检查),我正在寻找的结果是 <7, 8>
对,因为该对出现了两次。
那么如何从表中获取最常见的值序列,因为我需要使用 n 列来执行此操作。
Lets say I have a table like this.
A | B
-----
1 | 4
7 | 8
1 | 3
1 | 2
4 | 5
3 | 5
2 | 5
7 | 8
Even though 1
is the most common value in column A
and 5
is the most common value in column B
(which can be checked pretty simply with a COUNT()
) the result I am looking for is the pair <7, 8>
since that pair appears twice.
So how can I get the most common value sequence from a table, since I have n
columns that I need to do this with.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)