1SELECT x.prod_name
2 , SUM(x.total)
3 FROM ( SELECT bp.prod_name
4 , ( SELECT SUM( wh.quantity ) * bp.weight
5 FROM bus_warehouse_entries wh
6 WHERE bp.prod_code = wh.org_product_code ) AS total
7 FROM bus_products bp ) x
8 GROUP BY x.prod_name