取代字串:REPLACE(`欄位名稱`, '欲取代的字串', '取代後的字串')
UPDATE `table` SET `column` = REPLACE(`column`, 'efg', 'xxx') WHERE `column` LIKE 'efg%';
UPDATE `table` SET `column` = CONCAT('123', `column`) WHERE `column`='45';
(Result: 12345)
UPDATE `table` SET `column` = CONCAT(`column`, '123') WHERE `column`='456';
(Result: 456123)
UPDATE `table` SET `column` = CONCAT('123', `column`, '789') WHERE `column`='456';
(Result: 123456789)
沒有留言:
張貼留言