I have MyTbl like this
Id type amount
-- ---- ------
1 1 100
2 1 200
3 2 300
4 2 400
Is it possible to write a query for sqlite in Android that returns this?
Amount1 Amount2
------- -------
300 700
I have written the following query but it is not ok:
select SUM(a.amount) as Amount1, SUM(b.amount) as Amount2 from MyTbl a inner join MyTbl b
on a.id = b.id
group by a.type
it returns:
Amount1 Amount2
------- -------
300 300
700 700
SQL FIDDLE