How to replace the exact word in MySQL? -


i have query:

update tbl set fldname = replace(fldname,'st','stats'); 

however if begins letters st, such stump, statsump. how can have st replaced exact match? thanks!

afaik mysql not directly support regexp replacing (http://bugs.mysql.com/bug.php?id=27389), unless use user defined functions.

you try adding where char_length(fldname) == 5, though - match strings of length 5, , string of length 5 containing 'stats' is... 'stats'.

or of course ditch whole thing , set fldname='st' fldname == 'stats', sane thing unless query more complex example.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -