n8w Posted April 7, 2012 Share Posted April 7, 2012 I have a column that has values like record 1 = bob,nancy, sally record 2 = bob,nancy record 3 = nancy, sally What I would like to do is replace all instances of nancy with betty so all my records would look like this record 1 = bob,betty, sally record 2 = bob,betty record 3 = betty, sally can someone please point me in the right direction of what my sql statement should look like? Thanks Quote Link to comment Share on other sites More sharing options...
awjudd Posted April 7, 2012 Share Posted April 7, 2012 You can use MySQL's REPLACE function http://dev.mysql.com/doc/refman/5.0/en/replace.html Either do it in a SELECT statement (non-permanent) or an UPDATE statement (changing the actual values in the table). ~awjudd Quote Link to comment Share on other sites More sharing options...
n8w Posted April 8, 2012 Author Share Posted April 8, 2012 Thanks .. this worked great update client_table set company_name = replace(company_name, ‘Old Company’, ‘New Company’) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.