I have 2 statements in sqlite
1st Statement:
Select SUM(GrossQty) As GQTY, SUM(NetQty) As NQTY
From NSales
Where IMonth=5 And IYear=2012 And IDay>15
Result:
GQty NQty 30 25
2nd Statement
Select SUM(GrossQty) As GQTY, SUM(NetQty) As NQTY
From NSales
Where IMonth=6 And IYear=2012 And IDay<10
2nd Result:
GQty NQty 20 15
How can I combine these statements so that I get both these results added together like this?
Desired Result:
GQty NQty 50 40
You can do:
Alternatively:
Or you can use
CASEexpressions and avoid having to issue two separate subselects (harder to read):