Skip to content
Advertisement

how to select multiple sum() quantity

i want to select the sum of quantity(qty) from orders table,there are 2 category dirham (kupon_id = 2) and dinar (kupon_id = 1)

enter image description here

i already got the sum of kupon_id = 2,but i dont know how to get sum of qty where kupon_id = 1,here the example :

enter image description here

my model :

JavaScript

i tried join the same table with difference WHERE condition but its wrong :

JavaScript

update model :

JavaScript

enter image description here

the result shows both quantity of the id at difference row,i want it to show at Dinar,example like this :

enter image description here

Advertisement

Answer

Try this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement