Calculate Stock

Calculate Stock


Hello,
I'm developing a app that will control a small store. My quastion is:
I have the tables "Products", "Buy"  and "Sell". The last two are related to the product.

How do I sum all the records in the tables (Forms in Zoho Creator) "Buy" and "Sell" related to a specific product then I'd have the calcylated fields "TotalSells" and "TotalBuys", the i can calculate the remain in stock using TotalBuys - TotalSells

Thanks. Waiting your help...

Rodny :)