Cless Posted May 24, 2009 Share Posted May 24, 2009 With MySQL, is it possible to do a wildcard set? For example, when using search, you can say: SELECT * FROM blah WHERE b_moo LIKE '%2%' ...which would select all rows where b_moo has the number 2 in it. I need to do something similar in an UPDATE query, similar to: UPDATE blah SET b_moo='%3%' WHERE b_moo LIKE '%2%' ...which I want to replace all instances of the number 2 with 3 (or, atleast, the first instance). Is this possible? Thanks! Link to comment https://forums.phpfreaks.com/topic/159471-solved-wildcard-updates/ Share on other sites More sharing options...
waynew Posted May 24, 2009 Share Posted May 24, 2009 Have you tried it? Link to comment https://forums.phpfreaks.com/topic/159471-solved-wildcard-updates/#findComment-841203 Share on other sites More sharing options...
Cless Posted May 24, 2009 Author Share Posted May 24, 2009 Yeah, it just sets it to "%3%". xD Link to comment https://forums.phpfreaks.com/topic/159471-solved-wildcard-updates/#findComment-841206 Share on other sites More sharing options...
Mark Baker Posted May 24, 2009 Share Posted May 24, 2009 UPDATE blah SET b_moo=REPLACE(b_moo,'2','3') WHERE b_moo LIKE '%2%' Link to comment https://forums.phpfreaks.com/topic/159471-solved-wildcard-updates/#findComment-841209 Share on other sites More sharing options...
Cless Posted May 24, 2009 Author Share Posted May 24, 2009 Thanks! 8D Link to comment https://forums.phpfreaks.com/topic/159471-solved-wildcard-updates/#findComment-841232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.