SQL を使用してフィールド内の特定のテキストを置き換えるにはどうすればよいですか?
例の表:
id text
-------------------------------
1 hello my name is keven
2 hello my name is steve
3 hi my name is sam
残りのテキストをそのままにして、フィールド内でhelloどのように置き換えますか?hitext
UPDATE YOUR_TABLE SET `text` = REPLACE(`text`, 'hello', 'hi')
update TABLE_NAME set
FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);
Select id, REPLACE(text,'hello','hi') AS text from table;
データベースに多少依存しますが、ほとんどのデータベースで動作するはずです。