>Hi,
>
>3 tables with some data.
>
>head table :
>batchno
>11111
>22222
>33333
>44444
>
>detail table:
>batchno price
>11111 100.00
>11111 200.00
>22222 222.00
>22222 333.00
>33333 444.00
>33333 555.00
>44444 666.00
>44444 777.00
>44444 888.00
>
>taxes table:
>batchno taxes
>11111 10.00
>11111 20.00
>
>22222 22.20
>22222 33.30
>
>33333 44.40
>33333 55.50
>
>44444 66.60
>44444 77.70
>44444 88.80
>
>The output would be as :
>
>batchno subtotal taxes grandtotal
>11111 300.00 30.00 330.00
>22222 555.00 55.50 610.50
>.............................
>
>Tia
SELECT head.batchno
, SUM(detail.price) subtotal
, SUM(taxes.taxes) taxes
, SUM(detail.price) + NVL(SUM(taxes.taxes),0) grandtotal
FROM head
LEFT JOIN detail ON detail.batchno = head.batchno
LEFT JOIN taxes ON taxes.batchno = head.batchno
GROUP BY 1