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.
コンマで区切られた文字列値を含む mysql データベース列があります (例: apple, pear, orange, banana, grape)。各文字列値の両側に * を挿入する SQL ステートメントを作成する必要があります (例: *apple*,*pear*,*orange*,*banana*,*grape*)。これらの値を取得して解析する方法は知っていますが、* 文字を追加する方法はわかりません。任意の提案をいただければ幸いです。
apple, pear, orange, banana, grape
*apple*,*pear*,*orange*,*banana*,*grape*
UPDATE the_table SET the_column = CONCAT('*', REPLACE(the_column, ', ', '*,*'), '*')