TD注意

td中聚合函数count(a)只计算a不为null的个数,avg(a)计算平均时候也是不会考虑为null的个数,所以有时需要转换一下,eg:

,AVG (NULLIF ( a, 0)) (TITLE 'NIZ//AVG')  --如果a为0则设为null
,AVG (COALESCE ( a, 0)) (TITLE 'ZIN//AVG')--如果a为null则设为0
(FORMAT 'zz,zzz.z')
,COUNT (NULLIF ( la, 0)) (TITLE 'NIZ//COUNT')
(FORMAT 'zz9')
,COUNT (COALESCE ( a, 0)) (TITLE 'ZIN//COUNT')
(FORMAT'zz9')

你可能感兴趣的:(数据库技术)