jeudi 19 décembre 2019

Laravel db query from multiple tables

Im new to laravel db query. I have problem when want to query.

I have two table customer and history. In history it have few column which are customer_id, activity (purchase,buyback), product_type(gold,silver) and quantity. Currently I want to retrieve balance for each of customer. To get balance, purchase - buyback.

-> customer_id | gold_balance | silver_balance

Here I attach two part of table and code to be review.

enter image description here
enter image description here

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire