Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含字符串列表的重复字段 A。什么是找到与给定字符串一致的 TOP 字符串的好方法。因此,如果 A 持有主题标签,对于给定的主题标签 #T1,找到与 #T1 一致的标签在最多的记录数中。
您可以使用WITHIN和SUM(IF(...))来查找匹配项。例如:
WITHIN
SUM(IF(...))
SELECT hashtag, COUNT(*) AS cnt (SELECT tweet.hashtag as hashtag, SUM(IF(tweet.hashtag == '#T1', 1, 0)) WITHIN RECORD as tagz FROM [tweets]) WHERE tagz > 0 GROUP by hashtag, ORDER BY cnt DESC