1
我有狀態表和存儲56個狀態和ID,並且我正在基於存儲在[Cases]表中的那些ID更新FieldValue表中的值列。我可以用case語句來得到的結果,我不想再重複case語句56倍更新表格
Update cv
set Value =
case when
c.[state] = 1 then 13
c.[state] = 2 then 14
c.[state] = 3 then 15
.
.
.
End
from
[Cases] c
join
[files] f on f.FileName = c.Name
join
Recordset CR on CR.RecordId = f.id and RecordId = 3
join
FieldValue cv on cv.RecordsetId = cr.Id and cv.FieldId = 6
where
c.[State] is not null