I have these tables:
Orders:
id - status -user_id - address_id
1 await 1 1
products:
id - name - price - quantity
1 test1 100$ 5
2 test2 50$ 5
order_product:
order_id - product_id - quantity
1 1 2
1 2 2
cities:
id - name - shipping_charges
1 NY 30$
How can I count the total price of the these columns:
for each product:
products(price) * order_product(quantity)
for all products with shipping_charges
- products(price) * order_product(quantity) + cities(shipping_charges)