sql - mysql adding total price of certain products -
Hello I am having trouble in querying a product table at this time:
Let me show it to The total cost of all HP and Tashiba products is required ..
In this way I have tried so far
SELECT * products with WHERE prod_id '__hp%' and SELECT SUM value) Total from products;
Any help would be appreciated
This is a picture of the table of products - >>
Thanks;
If you are making clear that the third and fourth characters of Prod_ID are a manufacturer code, then you May help themselves a lot. HP and TA for Toshiba. SELECT SUBSTRING (prod_id, 3,2), SUM (value * on_hand) WHERE SUBSTRING (prod_id, 2,1) IN ('TA', 'HP') Assembling by group (prod_id) , 3,2)
Comments
Post a Comment