I want to select sum of all (paid) prices of an order item for each customer.
Here is SQL command: ...SELECT c.name,SUM(oi.price * oi.count) from customer c
JOIN order o ON c.id=o.customer_id
JOIN order_item oi ON o.id=oi.order_id
JOIN bill b ON b.id=oi.b...