SimonPrice33
asked on
SQL Sum
Hi Experts,
I am looking to sum a total on an order however... ive no idea how to pull it all together...
I have tried a nested query but it fails on me, not really don't nested queries before so struggling with it... however..
to get the list of results of an order back the SQL works, however... when adding the sum function it fails.
the SQL is
I am looking to sum a total on an order however... ive no idea how to pull it all together...
I have tried a nested query but it fails on me, not really don't nested queries before so struggling with it... however..
to get the list of results of an order back the SQL works, however... when adding the sum function it fails.
the SQL is
select
o.OrderNumber, o.WorkOrderNumber,
s.SupplierName,
o.SupplierOrderNumber, o.OrderDate, o.DueDeliveryDate,
oi.item, oi.qty,oi.PriceatOrder, oi.itemtotalcost,
oi.received
from SupplierOrders.Orders o
left join SupplierOrders.Suppliers s on s.SupplierID = o.SupplierID
left join SupplierOrders.Order_Item oi on oi.OrderNumber = o.OrderNumber--
where
o.OrderNumber = 27
select sum(oi.itemtotalcost) as OrderTotal
from SupplierOrders.Orders o
left join SupplierOrders.Suppliers s on s.SupplierID = o.SupplierID
left join SupplierOrders.Order_Item oi on oi.OrderNumber = o.OrderNumber--
where
o.OrderNumber = 27
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER