View Full Version : union query


lipin
05-31-2002, 07:48 AM
I have two tables(ONE & TWO) with the same fields.
You probably ask why two tables just alike, well I am importing them both from other departments to do some comparisons on.

For simplicity, lets say there are two fields
Name and Salary.

I am trying to use a union query to show each name once, with Salary total. I can't get the salaries to add, or the name to show up only once. Below is the statement I am trying but I can't figure what to put in WHERE line. Am I close to being on the right track? Is union query what I should be using?

Thanks for helping out.

SELECT [NAME],[SALARY]
FROM [ONE]
WHERE ???

UNION SELECT [NAME],[SALARY]
FROM [TWO]
WHERE ???

Rich
05-31-2002, 08:01 AM
Use a totals query on the Union query.

lipin
05-31-2002, 08:26 AM
OK, still trying to get union query to work
I have:

SELECT [NAME],[SALARY]
FROM [ONE]

UNION SELECT [NAME],[SALARY]
FROM [TWO]

and when I run it, I get an input box asking for SALARY parameters. Why?
I jsut want it to show all the records from both tables.

lipin
05-31-2002, 08:39 AM
OK, NEVERMIND ON THAT ONE, I GOT THE UNION QUERY CORRECT.