【发布时间】:2015-03-24 17:52:06
【问题描述】:
我想从我的数据库的 2 行中获取 3 个最常出现的字符串。问题是字符串可能出现在 column1 或 column2 中。我只想使用一个查询。提前致谢
示例数据库:
id string1 string2
1 foo bar
2 bar foo
3 api foo
输出应该是:
string count
foo 3
bar 2
api 1
【问题讨论】:
-
但这就是所有字符串!
-
我的数据库要大得多,最大的数应该超过 50 - 而且有超过 3 个字符串 ;)