I would like to sum 3 columns from the same table based on three unique id.
If id="1" sum(area1)
If id="2" sum(area2)
if id="3" sum(area3)
Table data:
id area1 area2 area3
1 10 2 10
1 1 10 10
2 1 10 10
3 1 10 10
3 10 2 10
Output should be:
id1= 43 id2 = 21 id3 = 43
Select houseID, sum(area1), b.sum(area2), c.sum(area3) FROM table1, table1 b, table1 c
WHERE table1.id="1" or b.id = "2" or c.id="3"
Edit:
Considering that you edited your output, you have to do: