Q
QuickSilver
Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT 日期,编号,
(select sum(数量) from 入库 BBB where (BBB.日期=AAA.日期) and (BBB.编号=AAA.编号)) AS 入库,
(select sum(数量) from 出库 BBB where (BBB.日期=AAA.日期) and (BBB.编号=AAA.编号)) AS 出库
FROM (select distinct 日期,编号 from 入库
union select distinct 日期,编号 from 出库) AAA
ORDER BY 日期,编号
结余数无法用SQL得到,只能自己计算
ACCESS及MS SQL支持以上语句,PARADOX是不支持的
(select sum(数量) from 入库 BBB where (BBB.日期=AAA.日期) and (BBB.编号=AAA.编号)) AS 入库,
(select sum(数量) from 出库 BBB where (BBB.日期=AAA.日期) and (BBB.编号=AAA.编号)) AS 出库
FROM (select distinct 日期,编号 from 入库
union select distinct 日期,编号 from 出库) AAA
ORDER BY 日期,编号
结余数无法用SQL得到,只能自己计算
ACCESS及MS SQL支持以上语句,PARADOX是不支持的