Is there any faster query way of rewriting these queries or by combining them?
update products
set shop = '1'
where shop LIKE '%demo%'
update products
set shop = '2'
where shop LIKE '%car%'
update products
set shop = '3'
where shop LIKE '%a开发者_如何学Crt%'
update products
set shop =
case
when shop like '%demo%' then 1
when shop like '%car%' then 2
when shop like '%art%' then 3
else shop
end
Maybe a stored procedure: http://www.sqlinfo.net/mysql/mysql_stored_procedure_UPDATE.php
精彩评论