SELECT tOrdersDetail.ProductId , SUM(tOrdersDetail.quantity) as Quantity1,SUM( tOrdersDetail.Price * Quantity) as Price1,tProduct.UnitPrice as uCost,SUM(Quantity * tProduct.UnitPrice) as Total_Cost .... -> wont work if i add this on ,( Quantity1/Price1) as Average_Cost
FROM tProduct
INNER JOIN tOrdersDetail
ON tOrdersDetail.ProductId=tProduct.ProductId
GROUP BY ProductId
LIMIT 0 , 30
I need to preform 2 more calculations in the result set...
My thought was to just add this and i can mamke calucation based on alias name....but no luck
( Quantity1/Price1) as Average_Cost
( Total_Cost/Price1) as Average_Cost
I get an error invalied field name...thanks
Last edited by psdeveloper; 11-01-2008 at 06:25 AM.
Reason: add
Bookmarks