On Jan 31, 2012, at 6:20 PM, Fredrick Ughimi wrote: > Now, I want to be able to use the SQL statement to do the above calculation > for all the products available (Not just ProductNo1 alone) in one SQL > Statement. Is it possible?
Sure. Join your various tables and group the result set by product, counting the various measurement along the way. E.g. select product.product_id, sum( inventory.??? ) as inventory, sum( sale.??? ) as sale, sum( receive.??? ) as receive, sum( balance.??? ) as balance from product left join inventory on inventory.product_id = product.product_id left join sale on sale.product_id = product.product_id left join receive on receive.product_id = product.product_id left join balance on balance.product_id = product.product_id group by product.product_id order by product.product_id _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users