我有一张这样的表:
- Votingid President_vote Vice_president_vote Senator_vote ...
- 1000 1023 1102 1042
- 1001 1102 1047 1102
- 1002 1023 1047 1042
- ...
所以我需要找到哪个人(id)对每个职位的投票最多,理想情况下结果如下
- President_vote Vice_president_vote Senator_vote ...
- 1023 1047 1042
我的表中大约有5列,因此可以从每列中找到最常用的值,然后将它们全部交叉连接。但是,假设此表中存在5000列。如何编写查询以查找每个列中出现的最常见值?谢谢!