Say I have a
product table with the following columns:
product -------- product_id name
And I have another table to record the transaction (IN/OUT) for each product
product_transaction -------------------- transaction_id transaction_date product_id type quantity
I want to have a page that lists that
products with its details including the current quantity. At the same time, I also want a page that lists all transactions within a day (or a range of dates) that also include the running total for the current transaction.
My question is, shall I store the running total in the
product_transaction table and the current quantity in the
product table. Or is it quick enough to just compute them on the fly?