这是问题:我希望用户在“状态”列中输入值“d%”,值为“完成”,如果输入“p%”,则设置值“处理”
示例代码:
create trigger Update_status
on orders
after insert, UPDATE
as
update orders
case orders.status like
when 'd%' then set orders.status='done'
when 'p%' then set orders.status='processing'
end
答案 0 :(得分:0)
整个case
语句必须是您将字段设置为的值。
create trigger Update_status
on orders
after insert, UPDATE
as
update orders
set order.status =
case
when orders.status like 'd%' then 'done'
when orders.status like 'p%' then 'processing'
end