是否可以在Doctrine中编写以下SQL查询?
UPDATE Inventory
SET
a = CASE WHEN a=id THEN NULL ELSE a END,
b = CASE WHEN b=id THEN NULL ELSE b END,
c = CASE WHEN c=id THEN NULL ELSE c END,
d = CASE WHEN d=id THEN NULL ELSE d END,
e = CASE WHEN e=id THEN NULL ELSE e END,
f = CASE WHEN f=id THEN NULL ELSE f END,
g = CASE WHEN g=id THEN NULL ELSE g END,
h = CASE WHEN h=id THEN NULL ELSE h END,
i = CASE WHEN i=id THEN NULL ELSE i END,
j = CASE WHEN j=id THEN NULL ELSE j END,
k = CASE WHEN k=id THEN NULL ELSE k END
WHERE userid=uid;
答案 0 :(得分:1)
不,Doctrine不支持CASE WHEN语句 - 你可以尝试使用RAW SQL ....