I have three tables
1 - Products
2- Orders
3- Order_item
Table (Products)
ID | Product_name |
--------------------
1 | Samsung Galaxy
Table (Orders)
ID | Client_name
-------------------
1 | Admin
Table (Orders_item)
ID | Order_ID | Product_ID | Quantity
-------------------------------------
1 | 1 | 1 | 1
2 | 1 | 1 | 1
3 | 1 | 1 | 1
I want to select product name , client name and number of quantities when order is 1. I have tried this query
SELECT products.name,orders.order_id,orders.client_name,order_item.quantity COUNT(*) FROM products,orders,order_item WHERE products.id = order_item.product_id AND orders.order_id = order_item.order_id AND orders.order_id=1
Which returns result like
Name | Order_ID | Client_name | Quantity
----------------------------------------
Sa..| 1 | Admin | 1
Sa..| 1 | Admin | 1
Sa..| 1 | Admin | 1
I want to get the the result like
Samsung | 1 | Admin | 3
Someone please help me .