I need formula help please!

G

Golfinray

I need a formula to do this: I just can't seem to get the syntax right.
We have 2 types of buildings, 1 is permanent, 2 is portable. I am summing
all permanent buildings. I want to add the replacement cost of a portable
building to the replacement cost of the permanent building IF a school has a
portable building. . If a school has 3 permanent buildings and 5 portable
buildings, I want to add the replacement cost of all 5 of the portable
buildings to the already summed cost of the 3 permanent buildings. If a
school has no portable buildings, leave the value alone. Thanks so much!!!
 
K

KARL DEWEY

I had to assume your field names and used Golfinray as table name.
SELECT Golfinray.School, Sum(IIf([Type]="1",1,0)) AS Permament,
Sum(IIf([Type]="2",1,0)) AS Portable, Sum(Golfinray.Cost) AS SumOfCost
FROM Golfinray
GROUP BY Golfinray.School;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top