SELECT p.prod_name, tb.quantity FROM ( SELECT prod_id, SUM(quantity) quantity FROM OrderItems GROUP BY prod_id ) tb, Products p WHERE tb.prod_id = p.prod_id;
SELECT p.prod_name, tb.quantity FROM ( SELECT prod_id, SUM(quantity) quantity FROM OrderItems GROUP BY prod_id ) tb, Products p WHERE tb.prod_id = p.prod_id;