samedi 17 octobre 2015

Summing 2 or more specific values from a table with multiple values inside it column

I have a table called products with the columns: Product, Price, Size and Units.

It has a total of 10 products in it but some products are repeated twice but have a different value for Price and/or Size.

Id like to use a command to see how much was spent on just Soup and Dogfood. If it matters, there are 2 occurrences of Dogfood in the Products; one with a price of 700, the other of 200 and just one of Soup which has a price of 257.

I know how to sum all the prices up in my table:

SELECT SUM (Price) ...> from products;

but I cant think of a way to exclude certain ones and add the remaining.

Aucun commentaire:

Enregistrer un commentaire