dt_all.Compute("sum(case when bnswxhl is null then 0 else bnswxhl end)+sum(case when gyxhl is null then 0 else gyxhl end)+sum(case when fgyxhl is null then 0 else fgyxhl end)", "lid in ('BB5_1','BB6_1','BB7_1','BB8_1','BB9_1','BB10_1')").ToString();如上部分代码片段,提示:聚合参数中的语法错误: 需要具有可能的“Child”限定符的单个列参数。
baidu、google没搞定
baidu、google没搞定
好像是:case when bnswxhl is null then 0 else bnswxhl end不对,直接sum(bnswxhl)就可以了。
但是sum(bnswxhl)出来的值如果是null就无法转为0了。
dt_all就是一个datatable,报错的问题就在于:
sum(case when bnswxhl is null then 0 else bnswxhl end)
如果把这个换成sum(bnswxhl)就可以,但是这样统计出来的如果是null的话我想让它变成0,用ISNULL不行,(我用oracle)Nvl也不行。
都不是普通sql语句,有其他办法吗