It is my sql code i want to show the Total SUM of current-sales by month of each product, in this image we can see the Total result in october of pro_id =175, i want to show the entry of every month of each product, is there any loop for many products? I will show the result in html table using php.
SELECT MONTHNAME(`order_date`), SUM(`current-sales`) AS TotalCS, `nsp`, `pro_id`
WHERE YEAR(order_date) = 2017 AND MONTH(order_date) = 10
AND pro_id = 175
GROUP BY. With this, you'll get the sum of the current sell of each pro_id by the months of 2017
SELECT MONTHNAME(order_date), SUM(current-sales) AS TotalCS, pro_id FROM orders WHERE YEAR(order_date) = 2017 GROUP BY MONTH(order_date), pro_id, nsp