SUM(CASE WHEN ISNULL(A.ReceiveQty,0)>0 THEN 1 ELSE 0 END) AS SumReceiveRolls是什么意思?
问题描述:
SUM(CASE WHEN ISNULL(A.ReceiveQty,0)>0 THEN 1 ELSE 0 END) AS SumReceiveRolls是什么意思?
在储存过程中,这句是什么意思SUM(CASE WHEN ISNULL(A.ReceiveQty,0)>0 THEN 1 ELSE 0 END) AS SumReceiveRolls,
答
A表里ReceiveQty大于0,值为1,否则为0,
然后把这些1,0加起来,当成一列(SumReceiveRolls)查询出来.