I want to find the SUM of values in a column weight. I want this sum for all records that are identified with a common value in one of the columns name. Further, I want to consider only those records that have a certain value in the column type.
name weight type
1 $ 12.00 A
2 $ 7.00 B
2 $ 7.00 A
1 $ 1.00 C
2 $ 7.00 B
1 $ 1.00 C
2 $ 7.00 B
1 $ 7.00 B
2 $ 7.00 C
2 $ 7.00 B
I want the total weight for name 2, for the types A and B. Can a subquery be written for this or only looping can be done. Tnx.