22,207
社区成员
发帖
与我相关
我的任务
分享
select itemtype,dateofoccor,code,ruku,chuku,
结存数量 =(select sum(isnull(ruku,0))-sum(isnull(chuku,0)) from tb where id <=a.id)
from tb a where hpid = '001'
order by id
select itemtype,
dateofoccor(日期)=dateofoccor,
code(单据号)=code,
ruku(入数量)=ruku,
chuku (出数量)=chuku,
结存数量 =(select sum(isnull(ruku,0))-sum(isnull(chuku,0)) from tb where id <=a.id)
from tb a
where hpid = '001'
order by id