ysai请看!刚才您回答的问题却是存在空值问题!在线等待!(30分)

  • 主题发起人 主题发起人 lkpc
  • 开始时间 开始时间
L

lkpc

Unregistered / Unconfirmed
GUEST, unregistred user!
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1440756
得到的结果中
是这样的:
bh(客户编号) ys(应收) yf(已付) qk(欠款)
001 300 150 150
002 200
请问如何用iff判断一下空值的问题!
 
sqlserver:
select a.bh,ys,yf,ys-isnull(yf,0) as qk from (
select bh,sum(ys) as ys from a group by bh
) as a left join (
select bh,sum(yf) as yf from b group by bh)
) as b on a.bh=b.bh
access:
select a.bh,ys,yf,ys-iif(yf is null,0,yf) as qk from (
select bh,sum(ys) as ys from a group by bh
) as a left join (
select bh,sum(yf) as yf from b group by bh)
) as b on a.bh=b.bh
 
谢谢了!
 
后退
顶部