开发者

Doctrine Set Case When

Is it possible to write in Doctrine the following SQL query?

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 THE开发者_运维百科N 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;


Nope, the CASE WHEN statement isn't supported in Doctrine - you could try using RAW SQL though ....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜