社区
基础和管理
帖子详情
decode的问题
FrancescoLongo
2006-08-29 10:05:22
当为001、002、003时,求值。
sum(decode (if_feeinfo.fee_code , '001' in '002' in '003',if_feeinfo.tot_cost,0 ))as ypfee。
上面这句话肯定有问题,小弟就是不清楚当为001、002、003时,用语句如何表示。
谢谢
...全文
299
9
打赏
收藏
decode的问题
当为001、002、003时,求值。 sum(decode (if_feeinfo.fee_code , '001' in '002' in '003',if_feeinfo.tot_cost,0 ))as ypfee。 上面这句话肯定有问题,小弟就是不清楚当为001、002、003时,用语句如何表示。 谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
feng2
2006-08-29
打赏
举报
回复
xiaoxiao1984(笨猫儿^_^)
使用函数decode()和in()
RobinHZ
2006-08-29
打赏
举报
回复
sum(decode(if_feeinfo.fee_code,'001',if_feeinfo.tot_cost,'002',if_feeinfo.tot_cost,'003',if_feeinfo.tot_cost,0)) as ypfee
你是这个意思么?
gw_delphi
2006-08-29
打赏
举报
回复
你说的求值啥意思.求和?不知道是不是你想要的
1. sum(decode(fee_code,'001',fee_code,'002',fee_code,'003',fee_code,0)) as ypfee
2. where fee_code in('001','002','003')
xiaoxiao1984
2006-08-29
打赏
举报
回复
1. sum( case when fee_code in ('001','002','003') then A
else D
end ) as ypfee
2. sum(decode(fee_code,'001',A,'002',A,'003',A,D)) as ypfee
FrancescoLongo
2006-08-29
打赏
举报
回复
可能是小弟没有表达清楚。
当为001或为002或为003时,求if_feeinfo.tot_cost的值。
不好意思
xiaoxiao1984
2006-08-29
打赏
举报
回复
1. sum( case fee_code when '001' then A -- fee_code = '001'则A语句处理
when '002' then B
when '003' then C
else D
end ) as ypfee
2. sum(decode(fee_code,'001',A,'002',B,'003',C,D)) as ypfee
gechangwei
2006-08-29
打赏
举报
回复
方法1:
sum(decode(if_feeinfo.fee_code , '001',if_feeinfo.tot_cost, '002' ,if_feeinfo.tot_cost,'003',if_feeinfo.tot_cost,0 )) as ypfee
方法2:
select sum(case when if_feeinfo.fee_code in ('001','002','002') then if_feeinfo.tot_cost else 0 end case) as ypfee
方法3:
select sum(decode(decode(if_feeinfo.fee_code,'001',1,'002',1,'003',1,0),1,if_feeinfo.tot_cost,0)) as ypfee
FrancescoLongo
2006-08-29
打赏
举报
回复
恩,当为001或为002或为003,求if_feeinfo.tot_cost的和。
深度学习框架-PyTorch实战
购买课程后,添加小助手微信(微信号:csdnxy68)回复【唐宇迪】 进入学习群,获取唐宇迪老师答疑 深度学习框架-PyTorch实战课程旨在帮助同学们快速掌握PyTorch框架核心模块使用方法与项目应用实例,让同学们熟练...
nginx对HTTP的POST请求的Url
decode
问题
nginx对HTTP的POST请求的Url
decode
问题
Dubbo之
decode
问题
与解决记录
Fail to
decode
request due to: RpcInvocation [methodName=addProduct, parameterTypes=[class .AddProductReqDTO], arguments=null, attachments={path=.ProductService, input=2314, dubbo=2.0.2, version=0.0.0...
'utf-8' codec can't
decode
问题
(python)
'utf-8' codec can't
decode
PHP里$_GET/$_POST变量的url
decode
问题
$_GET里的变量全都会自动进行url
decode
。 $_POST里的变量只有Content-Type: application/x-www-form-urlencoded下会自动进行url
decode
。
基础和管理
17,377
社区成员
95,128
社区内容
发帖
与我相关
我的任务
基础和管理
Oracle 基础和管理
复制链接
扫一扫
分享
社区描述
Oracle 基础和管理
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章