union query

K

kabaka

Just use the the UNION statement between 2 (or more) valid Select statments.
From the SQL design view (and it can only be done from here) type the
following (with your own parameters of course)


Select .....list of fields..... from [Table1] where......conditions......
Union
Select .....list of fields..... from [Table2] where......conditions......

Things to note:
1)You must have the same number of fields returned from each Select statment.

2)The fields must have the same data type.

Hope that helps
 
V

Van T. Dinh

The second note is incorrect. From Access2002 Help:

"...All queries in a UNION operation must request the same number of fields;
however, the fields do not have to be of the same size or data type."
 
V

Van T. Dinh

Have you check Access Help?

Help should always be the first source of info. since it is handy and very
quick to respond if you know what you are looking for.
 
K

kabaka

Oh, didn't know that. I guess I've always built them so that they did.
Still learning!

Van T. Dinh said:
The second note is incorrect. From Access2002 Help:

"...All queries in a UNION operation must request the same number of fields;
however, the fields do not have to be of the same size or data type."

--
HTH
Van T. Dinh
MVP (Access)




kabaka said:
Just use the the UNION statement between 2 (or more) valid Select statments.
From the SQL design view (and it can only be done from here) type the
following (with your own parameters of course)


Select .....list of fields..... from [Table1] where......conditions......
Union
Select .....list of fields..... from [Table2] where......conditions......

Things to note:
1)You must have the same number of fields returned from each Select statment.

2)The fields must have the same data type.

Hope that helps
 
Top