SELECT table1.attention, table2.tag, table3.ord_qty
FROM table1, table2, table3
WHERE table2.ob_oid = mlknt.table1.ob_oid
AND table3.sku = table2.sku
ORDER BY table2.tag ASC;
This pulls the correct info. However I get mulitple table2.tag lines, each with a different quantity. That is correct, but I would like to sum up all the rows and have one total for each unique value in table2.tag.
I understand there is a SUM function, but not sure how to get it to SUM unique values in the table3.ord_qty field based on the table2.tag field.
, SUM(table3.ord_qty) AS total_ord_qty
ON table2.ob_oid = table1.ob_oid
ON table3.sku = table2.sku
WHERE table1.attention = 'WR18834'
The tag column has multiples of the same tag number. Within the business logic, that makes sense, so that isn't necessarily wrong. I would just like to total up all the entries for each tag and just have one line per tag: