I have 3 tables A,B,C. A is parent of B and C. I want to get the all A rows with sum of B and sum of c.
Ex: table A:
id
1
2
3
table B:
id, parentid, data
1, 1, 12
2, 1, 23
3, 2, 24
table C:
id, parentid, data
1, 2, 44
2, 3, 23
3, 3, 24
what I want to get is:
A.id, B.sum, c.sum
1, 35, 0
2, 24, 44
3, 0, 47
Is it possible to get the output in single query.