I have a table with a sets of rows such as displayed below:
Qty Equip_ID
21487.92;"Load Center-6"
99272.59;"Load Center-10"
68088.61;"Load Center-11"
21821.5;;"Load Center-6"
102165.2;"Load Center-10"
72973.88;"Load Center-11"
21759.25;"Load Center-6"
102176.9;"Load Center-10"
63559.5;"Load Center-11"
How would I perform an addition operation and get the total of Load Center-6, 10 and 11? That way I can get the total for each group (6, 10, 11)
I tried using this sql statement based from the answer on this stackoverflow post http://stackoverflow.com/questions/9600587/how-to-sum-multiple-lines-in-sql but I get an sql error since WHERE condition can't be placed inside an SUM operation.
SELECT SUM(qty WHERE (equip_id = 'Load Center-6' AND equip_id = 'Load Center-10' AND equip_id = 'Load Center-11'))
FROM td_m2_fact GROUP BY facility_code, period_start;
Trying the SQL statement:
SELECT SUM(qty),Equip_ID FROM table GROUP BY Equip_id
Results:
Qty Equip_ID
672882459.189999;"Load Center-10"
124347378.953;"Load Center-6"
298342277.620001;"Load Center-11"
What I want:
Qty ID
SUM(21487.92,99272.59,68088.61) Load Center-6,Load Center-10,Load Center-11
SUM(21821.5,102165.2,72973.88) Load Center-6,Load Center-10,Load Center-11