Grouping with Sum Query

  • Thread starter Thread starter SteveR
  • Start date Start date
S

SteveR

I have a table that contains the following fields.

PrinterName Project Width Length TotalPrints
Xerox510 High Rise 36 48 10


I need to find the total Square Footage printed by project. I'm a bit lost
when it comes to grouping etc. Here is what I have so far which doesn't work.

Select PrinterName, Project, ((width * Length / 144)*TotalPrints) as SqFt
From Joblog
Where Printername = 'xerox510'
Group By Project Sum(SqFt)

Thanks

Steve
 
Hi Steve,

Try:

Select Project, Sum((width * Length / 144)*TotalPrints) as SqFt
From Joblog
Where Printername = 'xerox510'
Group By Project

Clifford Bass
 
I think I got it figured out. Here is what I came up with. So far it seems to
work.

SELECT ProjectName, sum(SqFt)As TotalSqFt
FROM (select ProjectName, PrinterName,((Width * Length / 144)*
TotalPrints) AS SqFt From JobLog where PrinterName = 'SXEROX510PS')as Test
Group by ProjectName;

Thanks for the response

Steve
 
Hi Steve,

With that you are making it more complicated than it needs to be. Did
you try my solution?

Clifford Bass
 
I tried your solution and although it ran without errors it didn't return any
information.
 
Hi Steve,

I see that you use different a different project column name and a
different printer name in your second statement from the one you orginally
posted. That may account for it. If you did not do so, try adjusting my
example to use the correct column and printer names.

Clifford Bass
 
I had adjusted the ProjectName field but missed the Printer name. That fixed
it! Your way is much easer!

Thanks!

Steve
 
Back
Top