明细帐
这样的台帐如何实现:   
 日期               收发类型               入库数               出库数               结存 
 07-05-8         入库                        100                                                         100 
 07-05-10      出库                                                            20                        80 
 07-05-12      出库                                                            10                        70 
 07-05-20      入库                        300                                                         370   
 拜托了!月底了,比较急
------解决方案--------------------select 产品名称,日期,收发类型,入库数=case 收发类型 when  '入库 ' then 数量 end, 
 出库数=case 收发类型 when  '出库 ' then 数量 end, 
 [结存]=(select sum(case 收发类型 when  '入库 ' then 数量 else -数量 end)  
 from test where 日期 <=a.日期) 
 from test a