我需要使用开关案例才能将数据插入数据库中的列!这是我的代码,但不起作用!
insert into fr(q)
values((select
case
when totalDue > 1000 then 'high'
else 'Low'
end as q
from fr))
要使该有效的insert
语句,取出代码的values ()
部分:
insert into fr (q)
select
case
when totalDue > 1000
then 'high'
else 'Low'
end as q
from fr
尽管我认为您可能正在尝试update
,而不是insert
行。
update fr
set q = case
when totalDue > 1000
then 'high'
else 'Low'
end;