问题
This is driving me crazy. I do a SELECT
first to make sure records exist:
Select * from gems WHERE page2 like '%acids-bases-salts%'
and get
Showing rows 0 - 8 ( 9 total, Query took 0.0012 sec)
Then try to UPDATE
to change those records:
UPDATE gems SET page2 = replace(page2, 'acids-bases-salts', 'abs') WHERE page2 LIKE '%acids-bases-salts%'
and get
0 rows affected. ( Query took 0.0019 sec )
What am I missing? This is simple one time query so I am not worried about performance.
回答1:
OK got it. The replace()
is case sensitive but the WHERE clause is not.
来源:https://stackoverflow.com/questions/20038101/mysql-update-query-with-like-in-where-clause-not-affecting-matching-rows