<p>例如,我在sqlite3中有这个列:</p>
<pre><code>hello world
hello you two
hello world
hello hello
</code></pre>
<p>我想提取最流行的单词及其出现的次数。
然而,直到现在,似乎只有找到细胞的存在才有可能。像这样:</p>
<pre><code>SELECT titles, COUNT(titles)
FROM standart_results
GROUP BY titles
ORDER BY count(*) DESC
</code></pre>
<p>它将返回<code>("hello world", 2)</code>。
但是我想要<code>("hello", 5)</code></p>
<p>我也不能用<code>LIKE</code>,因为我不知道哪个词出现得最多</p>
<p>我是否需要将数据传输到一个变量中并在其上使用regex,或者我可以使用sql来完成</p>
<p>你可以试试这个</p>
<pre><code>SELECT titles, COUNT(titles) as Appearances
FROM standart_results
GROUP BY titles
ORDER BY Appearances DESC LIMIT 1
</code></pre>