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
Post a Comment