Home > Archive > MySQL Server Forum > August 2005 > Sql Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sql Question
Joel

2005-08-24, 8:23 pm


Hi,

I'm writing an Sql Statement to total the sale of an order
TotalSale=(TotalSale
+ (QtyShipped * Price)). I have the syntax & it works
great.
However, I'd like to add Tax + Freight that is derived from another table.
How do I get it to add only once.

Here's the Statement:

"Select Orders.`Order_#`, Orders.`Cust_#`, Orders.`Name`, Orders.Date,
Orders.Status, Orders.`Po_#`, Sum(Olitems.Qty_Shipped * Olitems.Price) As
Total_Sale From Orders, Olitems Where Orders.`Order_#` = Olitems.`Order_#`
Group By Orders.`Order_#` Order By Orders.`Order_#` "

Olitems=Line Item Table
Orders=Header Table

I'd like to include:
Sum((Olitems.Qty_Shipped * Olitems.Price) + Orders.Tax + Orders.Freight) As
Total_Sale

When I do that it keeps on adding tax & freight for each line item! How to
work around that?

Thanks for all your help.



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com