17 Reputation Points
Ranked #1K
- Strength to Increase Rep
- +2
- Strength to Decrease Rep
- -0
100% Quality Score
- Upvotes Received
- 2
- Posts with Upvotes
- 1
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: 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. | |
Re: 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 intrinsic functions are depreciated with certain versions. | |