im having issues getting a query to output how i want,
SELECT
`orders`.`item_id`,
`products`.`item_code`,
`products`.`item_name`,
`orders`.`quantity`
FROM
`orders`
JOIN `products` ON `orders`.`item_id` = `products`.`id`
JOIN `suppliers` ON `products`.`supplier_ref` = `suppliers`.`supplier_ref`
WHERE
`suppliers`.`id` = 159
AND `orders`.`order_status` = 'NOTED'
which is returning the results:
item_id item_code item_name quantity
1271 RA001G Green Mop Bucket 12L 2
1270 RA001 Blue Mop Bucket 12L 1
1270 RA001 Blue Mop Bucket 12L 1
but i would like it to bring back distinct item_id with the quantity added together how ever when i've tried to add distinct and count i end up only have one line returned.
group byclause.