select sum in mysql code example
Example 1: sum mysql column
SELECT sum( mark ) FROM `student`
Example 2: mysql select inside sum
SELECT x.prod_name
, SUM(x.total)
FROM ( SELECT bp.prod_name
, ( SELECT SUM( wh.quantity ) * bp.weight
FROM bus_warehouse_entries wh
WHERE bp.prod_code = wh.org_product_code ) AS total
FROM bus_products bp ) x
GROUP BY x.prod_name