I am a novice with PHP, I am unable to determine how to get a SUM of a table calculation.
I have a table that has order numbers in field one and the item ordered and details about the item in fields 2 and 3 and 4 etc.
I am able to show [by a lot of help I got in this forum] the sum of all of the items in an order.
Here is my MSSQL table:
ORDER_NUMBER | ITEM_NUMBER | QUANTITY | PRICE |
67895 | BR124 | 1 | 2.00
67895 | FG536 | 1 | 2.00
67895 | M56 | 1 | 2.00
67895 | PFHR3 | 1 | 3.00
99678 | XC124 | 1 | 4.00
99678 | SF36 | 1 | 4.00
99678 | VM56 | 1 | 4.00
99678 | YYR3 | 1 | 5.00
I used this
SELECT order, sum(price)
FROM table
GROUP BY order_number;
to have PHP create a web table using the above table that shows the SUM of all of the items on each order like the following.
ORDER_NUMBER | TOTAL_ORDER_PRICE |
67895 | 9.00
99678 | 17.00
Now I would like to show a SUM of the "TOTAL ORDER PRICE" column or 26.00