是否有更快的查询方式重写这些查询或将它们组合在一起?
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 '%art%'
答案 0 :(得分:4)
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
答案 1 :(得分:0)