i used mysql version 5.7, i have a table production for every product, amount, and using many expeditions like this
+---------+-----------------+------+--------+---------+
| Product | Type_Expedition | Pack | Amount | Weight |
+---------+-----------------+------+--------+---------+
| Chicken | A | 1 | 2 | 2 |
| Beef | A | 1 | 2 | 2 |
| Lamb | B | 1 | 2 | 2 |
| Beef | B | 2 | 2 | 4 |
| Chicken | A | 3 | 2 | 6 |
| Lamb | A | 1 | 1 | 1 |
| Lamb | A | 1 | 1 | 1 |
+---------+-----------------+------+--------+---------+
how to calculate sum of weight and amount for type_expedition B and non-B (all type expedition except B) ?
i assume using this syntax (sorry i want to using dbfiddle.uk but it's error)
select product, type_expedition, pack, amount, weight, (sum(amount) where type_expedition = B), (sum(weight) where type_expedition = B) from my_table
expected results
+---------------------------------------------------+---+----+
| Total amount and weight for type_expedition B | 4 | 6 |
+---------------------------------------------------+---+----+
| Total amount and weight for type_expedition NON B | 8 | 12 |
+---------------------------------------------------+---+----+