• Member Avatar for drmrkrch
    drmrkrch

    Replied To a Post in Mysql query for sum two table data by product wise

    SELECT p.product_id, SUM(s.quantity) AS 'sale', SUM(p.quantity) AS 'purchase' FROM purchase p LEFT JOIN sale s ON (s.product_id=p.product_id) GROUP BY p.product_id; This should give you what you need.
  • Member Avatar for drmrkrch
    drmrkrch

    Replied To a Post in Updating Mysql Database

    You are defining your SQL statement in line 13 however you're not executing it. It would be mysql_query ($sql); Consult your version of php for the exact syntax as some …

The End.