Subject help on query
Author Sudheer Palaparambil
Hi

I have table data like this

products
========
id description
-------------------------------------------
1 product 1
2 product 2
3 product 3


sale_det
========
id product_id qty_sold
-----------------------------------------
1 1 10
1 2 20
2 2 50
2 3 30
2 1 20
3 2 40
3 3 20


purchase_det
============
id product_id qty_purchased value
------------------------------------------------------
1 2 500 5000.00
2 3 300 3000.00
3 1 200 2000.00


How do I get a result set like the following ?

product_id sold_qty purchased_qty purchase_value
-------------------------------------------------------------------
1 30 200 2000.00
2 110 500 5000.00
3 50 300 3000.00

Thank you.

Sudheer Palaparambil