multiple expression in Queries

P

PowerPoint Jedi

I have 8 different tables. I would like to sum up that data in one column of
each table and display all 8 sums in one query.

I wrote this to test my expression
SELECT Sum([Accutorr PlusT]!Failures_Y2006*[Accutorr PlusT]![STD COST]) AS
Expr1 FROM [Accutorr PlusT];

This worked and correctly displayed the value

I then expanded that to include another table and wrote this
SELECT Sum([Accutorr PlusT]!Failures_Y2006*[Accutorr PlusT]![STD COST]) AS
Expr1, Sum(AnestarT!Failures_Y2006*AnestarT![STD COST]) AS Expr2
FROM [Accutorr PlusT], AnestarT;

Now it doesn't work.

What am I doing wrong.

Thanks for any input
 
K

KARL DEWEY

You did not set a relationship for the tables. But my guesss is they have no
relation.
Use a union query like this ---
SELECT Sum([Accutorr PlusT]!Failures_Y2006*[Accutorr PlusT]![STD COST]) AS
Expr1, 0 AS Expr2
FROM [Accutorr PlusT]
UNION SELECT 0 AS Expr1, Sum(AnestarT!Failures_Y2006*AnestarT![STD COST])
AS Expr2
FROM AnestarT;

NOTE -- In a union query all fields must be the same datatype.
 
P

PowerPoint Jedi

That worked great thanks

One more question is there an easy way to make that into a make table query?
 
J

John W. Vinson

That worked great thanks

One more question is there an easy way to make that into a make table query?

Just save the UNION query and then create a MakeTable query based on that
UNION query.
 

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