百色汽车网

oracle怎样根据case when 条件update纵表的值

发布时间:2020-09-09

你应该这样写

select * from 表
where 1=1
and (case when a=1 then a when 表.字段='asdfasdf' then b end)='值

回复:

提供表结构,查询要求。看看我能不能帮你。

你给我的语句按如下调整,写成这样:
SELECT b.Group_Id,
sum(CASE WHEN TRIM(a.Op_Code) = '1000' OR TRIM(a.Op_Code) = '1002' THEN 1 ELSE 0 END) "1|开户",
sum(CASE WHEN TRIM(a.Op_Code) = '1110' THEN 1 ELSE 0 END) "2|补卡",
sum(CASE WHEN TRIM(a.Op_Code) = '1104' OR TRIM(a.Op_Code) = '1111' THEN 1 ELSE 0 END) "3|产品变更",
sum(CASE WHEN TRIM(a.Op_Code) = '1114' THEN 1 ELSE 0 END) "4|改密",
sum(CASE WHEN TRIM(a.Op_Code) = '3920' THEN 1 ELSE 0 END) "4|改资料",
sum(CASE WHEN TRIM(a.Op_Code) NOT IN ('1000','1002','1110','1104','1111','1114','3920') THEN 1 ELSE 0 END) "0|其他业务"
FROM Or_Ordline_Info_201212 a,
Bs_Channelclass_Dict b,
Bs_Loginmsg_Dict c
WHERE b.Group_Id = c.Group_Id
AND a.Login_No = c.Login_No
GROUP BY b.Group_Id
ORDER BY b.Group_Id;

回复:

case when是不支持单独使用的。 如果单独的条件判断,就需要PL/SQL语句 IF A=1 THEN B := 1; ELSEIF A=2 THEN B := 2; ELSE B := 3; END IF;

回复:

给你看一个例子吧! update tbForum set UltimoScore= (case when AllScore-RemainScore=0 and ActivityDegree=301 and ActivityDegree=801 and ActivityDegree=2001 and ActivityDegree=4001 and ActivityDegree8000 then 9000 end),UltimoDegr...

回复:

提供表结构,查询要求。看看我能不能帮你。 你给我的语句按如下调整,写成这样: SELECT b.Group_Id, sum(CASE WHEN TRIM(a.Op_Code) = '1000' OR TRIM(a.Op_Code) = '1002' THEN 1 ELSE 0 END) "1|开户", sum(CASE WHEN TRIM(a.Op_Code) = '111...

回复:

1 update p set a='web' where a=3 and b=4; update p set a='wap' where b=5; 2 update p set a=(case when a=3 and b=4 then 'web' when b=5 then 'wap' end);

回复:

这样?order by (case when type=‘vip’ and level = '1' then 11 when type=‘vip’ and level = '0' then 12 else 99 end), creatTime desc

    上一篇:手续都好了一人一张黄色单子当事人没去车子能开走吗 下一篇:Global Registered Share是什么意思?

      返回主页:百色汽车网

      本文网址:http://0776auto.cn/view-79601-1.html
      信息删除