単語を含むvarchar列があります。@variablesを動的に作成し、列の値を使用して各変数に名前を付けて、各単語の数を保持したいと思います。
//Define all variables in PHP dynamically
@word1:=0, @word2:=0;
//Select and count how many times each word exists
SELECT (@column_value:=@column_value+1) AS words FROM Data ORDER BY words
上記の「@column_value」は「@word1」..「@word2」などである必要があります。
お手伝いありがとう。