Re: union query
Tech-Archive recommends: Fix windows errors by optimizing your registry
On Mon, 16 Oct 2006 10:05:02 -0700, sierralightfoot
<sierralightfoot@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have two tables with identical fields. I want to query each table for a
creteria without appending, merging, linking etc. the tables. I am not
looking to match values between the tables, just look up info from each, at
one time.
Is a union query the way to go and is there a wizard that will help me?
Yes, but there's no wizard.
It's easy enough though. Create a Query based on one of the tables,
with whatever criteria you want; test it to be sure it's retrieving
the right values.
Then use View... SQL, or the leftmost tool in the query design toolbar
as a dropdown to select SQL view. You'll see something like
SELECT table1.field1, table1.field2, table1.field3 FROM table1 WHERE
<various criteria>;
Edit this to delete the semicolon and add UNION ALL after it; then
copy and paste the SQL after the UNION ALL, and edit all references to
Table1 to Table2 (or whatever your tablenames actually are).
John W. Vinson[MVP]
.
Relevant Pages
- Re: Please help me evolve this concept
... complex SQL SELECT statements including UNION, OUTER JOINS, GROUP BY, ... It sure will save you a lot of time and coding if all you need is to query ... I could modify this in code and qActorSelect stays 'dynamically ... creating a union query based on qActorSelect as opposed to ... (microsoft.public.dotnet.framework.adonet) - RE: adding 2 fields including null entries
... First I'll go through the method that will not use the crosstabs. ... we'll define the select query for the PSS Names: ... Note that you could paste the sql from either of the queries above in the ... Next, we want to combine these results, so we use a union statement. ... (microsoft.public.access.queries) - RE: number of columns doesnt match bug in Access
... The naming of the fields using reserved words could be an source of problems ... Also you use as an alias in the SQL. ... as they must in a Union Join. ... I have a union query which regularily generates the "number of columns ... (microsoft.public.access.queries) - RE: number of columns doesnt match bug in Access
... Also you use as an alias in the SQL. ... as they must in a Union Join. ... I have a union query which regularily generates the "number of columns ... I use the VBA code On Error resume to get it to work - ... (microsoft.public.access.queries) - RE: report / Query
... CreditAgency field to store the CreditAgency ID number from a CreditAgency ... Then I would create a union query, which is simply two independent queries ... created both queries, switch to SQL View in one of them and ... (microsoft.public.access.gettingstarted) |
|