View Single Post
Old 12-14-2012, 11:06 PM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
The SUM of the column should do it. Notice it is the first thing in the query -not because it has to be done like that but because I didn't want it to get lost in the sea of columns and tables in the query.

PHP Code:
$sql "SELECT SUM(order_details.UnitPrice) as TotalPrice, customers.CompanyName, orders.CustomerID, orders.OrderID, order_details.OrderID, order_details.ProductID, products.ProductID, products.ProductName, order_details.UnitPrice, order_details.Quantity, orders.shipVia, shippers.shipperId, shippers.CompanyName, orders.Freight
    FROM customers, orders, order_details, products, shippers
    WHERE customers.CustomerID = orders.CustomerID
    AND orders.OrderID = '" 
$_GET['order'] . "%'
    AND orders.OrderID = order_details.OrderID
    AND order_details.ProductID = products.productID
    AND orders.ShipVia = shippers.ShipperID
    ORDER BY products.productName, products.UnitsInStock, products.UnitPrice, shippers.CompanyName, orders.Freight"

__________________
For professional Hosting and Web design.....


NetEssentials.co.uk
Redcoder is offline   Reply With Quote