我在查找单词出现在整个表格中的总次数时遇到了麻烦。 我的代码目前只计算单词出现在每一行中的次数。我该如何解决这个问题?
SELECT comments, COUNT(*) AS total FROM AE
WHERE comments like '%'%'
GROUP BY comments
如果您想要更多代码,请询问:)
答案 0 :(得分:0)
你可以获得COUNT
SELECT COUNT(*) AS total FROM AE
WHERE comments like '%abcd%'
您只需使用WHERE
SELECT comments AS total FROM AE
WHERE comments like '%abcd%'
如果您希望COUNT
重复评论,则可以使用“CROSS APPLY”
select * from (SELECT comments
FROM AE
WHERE comments like '%abcd%' ) T
CROSS APPLY
( SELECT COUNT(*) AS total FROM AE
WHERE comments like '%abcd%' ) T2
答案 1 :(得分:0)
这个数字是否足够?
SELECT COUNT(comments) AS total FROM AE
WHERE comments like '%'%'