mysql - Replace entire text with part of text string SQL -


im trying update on sql db replace not sure how entire text replaced. using field in ps_product called "location" , want replace rows contains "k" "". example, have row called "k18b" , want replace row containing "k%" replaced "".

i got update thinks replaces "k" , not entire row.

 update ps_product  set location = replace(location, 'k%', '')   location like('k%'). 

anyone can me? want result "" rows contains "k", example k18b -> ""

its unclear want here possibilities come mind


if want remove ks, 1k8b becoming 18b:

 update ps_product  set location = replace(location, 'k', '')  

if want strip ks locations beginning k, k18b becoming 18b:

 update ps_product  set location = replace(location, 'k', '')   location 'k%' 

if want set blank locations beginning k, k18b becoming '' :

 update ps_product  set location = ''  location 'k%' 

if want set blank locations containing k, 1k8b becoming '' :

 update ps_product  set location = ''  location '%k%' 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -