A
admin2008
Unregistered / Unconfirmed
GUEST, unregistred user!
日期 ID码 入库量 出库量 库存量<br>2008-01-15 1001 10 1 9<br>2008-01-15 1002 8 4 13<br>2008-01-15 1003 15 10 18<br>我想得出这样的结果当点查询按钮 在dbgrideh中显示<br>我是通过视图<br><br>ALTER view v_yaopin_GZ<br>as<br>select a.in_date as date,<br>'入库' as type,<br>b.mount as addmount,--入库数量<br>0 as lowmount,--出库数量<br>0 as cgmount,--库存数量<br>b.SYS_ID as sys_id,<br>a.in_id as bill_id,<br>d.yaoid as yaoid<br>from inhead a,inhouse b,yaoid d c<br>where a.in_id=b.in_id and b.yaoid=c.yaoid <br>union<br>select a.out_date as date,<br>'出库'as type,<br>0 as addmount,<br>b.mount as lowmount,<br>0 as cgmount,<br>b.SYS_ID as sys_id,<br>a.out_id as bill_id,<br>c.yaoid as yaoid<br>from Other_head a,Other_outhouse b, yaoid c<br>where a.out_id=b.out_id and b.yaoid=c.yaoid<br>现在就是库存数量算不出来,应怎么样得出如上图的结果呢 只能通过一张视图<br>当然可以另创建一张表 但这不妥