LaserBeak LaserBeak - 9 months ago 42
SQL Question

Find if a string from one field is contained in another field on the same row and delete it if so

Say I have the following fields in each row

Make Model
Toyota Toyota Camry

I need a query that will check if the string in Make is also contained in Model and delete the portion of Model value that matches.


Perhaps this is what you're looking for with replace:

update yourtable 
set model = replace(model, make, '');