get stock from substraction of sales from purchases for all items

I am inexperienced with firebird or SQL, nevertheless I need to export fields that meet certain criteria from a Firebird database. The entire database weights 2 GB, I dont think I can easily share it with someone. The problem lies with the quatity of products. Aparently it is not embeded in a table´s colum but is fetched through a procedure that is called through an item id. This procedure I will share if someone requests it.

My thoughts are, if the quantity can be called through a procedure, then the call can be modified to export only available items to a table. whole positive non-zero values can be exported to their own table. Thus reducing the ammount of items to only those in physical inventory.

the procedure is basically substracting sales from purchases.

I would appreciate any replies that may shine a light to my thoughts, and will promptly reply with the above mentioned procedure if anyone is willing to take a shot at this.

Any other suggestions or comments are welcomed.

0 answers