calculating SUM

From: shank (shank_at_tampabay.rr.com)
Date: 03/10/04


Date: Tue, 9 Mar 2004 19:19:35 -0500

I have the following query that I'm trying to get SUM values.
In the SELECT clause I can calculate horizontally. This works fine.
ItemPrice.ProPrice * dbo.SaleGroups.Quantity AS LineTotal
But when I try to get a SUM total of LineTotal, it says there's no such
column
How do I get a grand total I can use?
thanks!
-------------------------
SELECT ItemStock.OrderNo, ItemPrice.ProPrice, dbo.SaleGroups.Quantity,
dbo.SalePrice.SalePrice, dbo.SalePrice.Savings, ItemPrice.ProPrice *
dbo.SaleGroups.Quantity AS LineTotal
FROM ItemStock LEFT OUTER JOIN ItemPrice ON ItemStock.OrderNo =
ItemPrice.OrderNo RIGHT OUTER JOIN dbo.SaleGroups ON ItemStock.OrderNo =
dbo.SaleGroups.OrderNo RIGHT OUTER JOIN dbo.SalePrice ON
dbo.SaleGroups.SaleGroup = dbo.SalePrice.SaleGroup
WHERE (dbo.SaleGroups.SaleGroup = 'WSPK')
ORDER BY ItemStock.OrderNo
COMPUTER SUM(LineTotal)



Relevant Pages

  • Re: Optimising the Query
    ... SUM ... FROM TABLE3 ... The query is taking records from TABLE2 and TABLE3 and LEFT OUTER JOIN ...
    (comp.databases.oracle.misc)
  • Re: Trying to optimize a query with a bunch of INNER JOINs
    ... It can help to put the meat of the query in the derived table and then do ... A right outer join is just a left outer join turned around, ... Pro SQL Server 2000 Database Design - ... and it's taking just as long as with the sum. ...
    (microsoft.public.sqlserver.programming)
  • Re: Query Conflict
    ... the following query with good results. ... 66 Plus] FROM [Lake Worth CFP Clients] ... The conflict appears to be between the city criteria and the SUM ... any field in the WHERE clause also has to be ...
    (comp.databases.ms-access)
  • Re: Query Conflict
    ... the following query with good results. ... I now want to add an additional criteria of the city field. ... The conflict appears to be between the city criteria and the SUM ... the SELECT clause. ...
    (comp.databases.ms-access)
  • Re: Query Conflict
    ... running the following query with good results. ... 66 Plus] FROM [Lake Worth CFP Clients] ... SUM of the ages. ... any field in the WHERE clause also has to be ...
    (comp.databases.ms-access)