求一个存储过程???????在线等!!!!
现在我有三个表: storage,instorage和outstorage
分别包含的字段为:
storage:id,materialid,amount
instorage:instorageid,materialid,amount,instoragedate
outstorage:outstoageid,mateiralid,amount,outstoragedate
现在要做一个月报表,形式为
storage里面所有的物资,上月库存数量,这个月进库数,出库数,现库存数量
我现在做法是每次都要取storage里面的materialid,然后在instorage和outstorage进行查找是否存在进库和出库,这样后台就要运算很长的时间(因为涉及到的物资有上万种),能不能用个存储过程然后从存储过程里面直接去出来呢?