SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 calculation in a query
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

joemama
Posting Yak Master

113 Posts

Posted - 05/16/2005 :  15:43:57  Show Profile
the query below i have that works fine...

but now i want to have

dbo.ProdOrderDetails.DetailQuantity * dbo.ProdOrderDetails.DetailProdPrice = a new column called ItemTotal

can someone tell me how to do it?




CREATE VIEW dbo.QryCartDetails
AS
SELECT dbo.ProdOrderDetails.DetailGUID, dbo.ProdOrderDetails.DetailQuantity, dbo.ProdOrderDetails.DetailOrderID, dbo.Products.ProdName,
dbo.Products.ProdShortDesc, dbo.Products.ProdLongDesc, dbo.Products.ProdID, dbo.ProdOrderDetails.DetailID, dbo.ProdScent.ProdScentLabel, dbo.ProdSize.ProdSizeLabel, dbo.ProdSize.ProdWeight, dbo.ProdOrderDetails.DetailProdPrice
FROM dbo.Products INNER JOIN
dbo.ProdOrderDetails ON dbo.Products.ProdID = dbo.ProdOrderDetails.DetailProdID LEFT OUTER JOIN
dbo.ProdSize ON dbo.ProdOrderDetails.DetailSize = dbo.ProdSize.ProdSizeID LEFT OUTER JOIN
dbo.ProdScent ON dbo.ProdOrderDetails.DetailScent = dbo.ProdScent.ProdScentID

JimL
SQL Slinging Yak Ranger

USA
1534 Posts

Posted - 05/16/2005 :  15:49:26  Show Profile  Visit JimL's Homepage
CREATE VIEW dbo.QryCartDetails
AS
SELECT dbo.ProdOrderDetails.DetailGUID, dbo.ProdOrderDetails.DetailQuantity, dbo.ProdOrderDetails.DetailOrderID, dbo.Products.ProdName,
dbo.Products.ProdShortDesc, dbo.Products.ProdLongDesc, dbo.Products.ProdID, dbo.ProdOrderDetails.DetailID, dbo.ProdScent.ProdScentLabel, dbo.ProdSize.ProdSizeLabel, dbo.ProdSize.ProdWeight, dbo.ProdOrderDetails.DetailProdPrice,
dbo.ProdOrderDetails.DetailQuantity * dbo.ProdOrderDetails.DetailProdPrice As ItemTotal

FROM dbo.Products INNER JOIN
dbo.ProdOrderDetails ON dbo.Products.ProdID = dbo.ProdOrderDetails.DetailProdID LEFT OUTER JOIN
dbo.ProdSize ON dbo.ProdOrderDetails.DetailSize = dbo.ProdSize.ProdSizeID LEFT OUTER JOIN
dbo.ProdScent ON dbo.ProdOrderDetails.DetailScent = dbo.ProdScent.ProdScentID

Jim
Users <> Logic

Edited by - JimL on 05/16/2005 15:50:16
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000