I have 3 tables. table A has two fields code and item. Table B has 3 fields code, qty_recd and recd_dt. Table C has 3 fields Code, qty_sold, sold_dt. I want to get a result in this way:
For each record in Table A, sum of qty_recd from Table B and sum of qty_sold from Table C.
TABLE-A
code Item
----- ------
A1 AMMONIA SOLUTION
TABLE-B
code qty_recd recd_dt
----- -------- -------
A1 5 2013-06-01
A1 8 2013-04-18
A1 3 2013-05-22
TABLE-C
code qty_sold sold_dt
----- -------- -------
A1 1 2013-08-10
A1 4 2013-09-01
A1 2 2013-05-11
I want result like this
code item tot_recd tot_sold
----- -------- ------- --------
A1 AMMONIA SOLUTION 16 6
I tried several constructs, but not getting desired output. Please help to construct SELECT statement