select a.入库-b.出库-b.出租+a.回收 as 库存数量 from 入库表 a , 出库表 b where a.商品代码=b.商品代码
解决方案 »
- 增加新订单时,如何判断会不有日期冲突
- 字符串解析代码出错
- access2000中对表能否使用truncate table 来清空旧的序号,如果能则怎样做?
- delphi 与 dll编程
- Delphi如何操作XML节点的添加修改删除并显示到程序做为菜单使用
- FASTREPORT的frUserDataset怎么使用?谁请给个例子,谢谢
- 关于hint的问题
- 急需一个c/s事例代码
- 各位高手,请问如何用Delphi连接SysBase数据库
- 看谁能解决“小儿科”问题??
- 挥泪求救系列之二:CAD软件中图形类应该如何设计
- Intercepor的问题,现在改了demo中的程序,加了加密程序,但是不成功,请赐教,100分
Select Sum(入库数) as Num
From Table1
Where Type='入库'
union all
Select 0-Sum(出库数) as Num
From Table1
Where Type='出库'
union All
Select 0-Sum(出租数) as Num
From Table2
Where Type='出租'
union All
Select Sum(回收数) as Num
From Table2
Where Type='回收'
) as F
where 出入库记录表.id=出租回收记录表.id group by 出入库记录表.id出租回收记录表.id
From CodeTable d1
Left outer join inTable d2 on d1.Code=d2.Code
Left outer join inTable d3 on d1.Code=d3.Code
From CodeTable d1
Left outer join inTable d2 on d1.Code=d2.Code
Left outer join inTable d3 on d1.Code=d3.Code
而且记录中数量要依据物品代码sum