我正在尝试写一个这样的案例陈述。有人可以帮助解决语法
UPDATE A
CASE WHEN ATTDESC = 'ABC' THEN SET A.DESC = PG.VAL + ' - ' + LD.DESC + ' - ' + GH.PL3NAME
WHEN ATTDESC = 'DEF' THEN SET A.DESC = PG.VAL + ' - ' + LD.DESC + ' - ' + GH.PL3NAME
END
FROM ATTR A, PRODUCT PG, Global GH, Look LD
答案 0 :(得分:0)
CASE表达式不控制流程;它返回一个值。所以像这样:
...
SET [DESC]=CASE [ATTDESC]
WHEN 'ABC' THEN PG.VAL + ' - ' + LD.DESC + ' - ' + GH.PL3NAME
WHEN 'DEF' THEN PG.VAL + ' - ' + LD.DESC + ' - ' + GH.PL3NAME
ELSE [DESC]
END
FROM
...