Merging record sets from 2 Queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ihave two Queries Q1 and Q1 both contain employee IDs. such as

Q1 Q2
EID2 EID4
EID3 EID7
EID7 EID9
EID2 EID3

I need to get the record set below. I can do this with an append table but
there must be a way to get it done with a Query
EID2
EID3
EID4
EID7
EID9

Any help is appreciated

Steve
 
Steve said:
Ihave two Queries Q1 and Q1 both contain employee IDs. such as

Q1 Q2
EID2 EID4
EID3 EID7
EID7 EID9
EID2 EID3

I need to get the record set below. I can do this with an append table but
there must be a way to get it done with a Query
EID2
EID3
EID4
EID7
EID9


Use a Union query:

SELECT Eid FROM Q1
UNION
SELECT Eid FROM Q2
 
That seemed to work but what would look like in design view. I expected the
design view to show me something but that item on the selection menu is
greyed out.

Steve
 
Steve said:
That seemed to work but what would look like in design view. I
expected the design view to show me something but that item on the
selection menu is greyed out.

UNION queries (and a few others) will not display in the GUI designer tool.

(eventually you gotta learn some SQL) :-)
 
I remember enough from SQL classes 15 years ago to understand and read SQL
but I just assumed the GUI would interpret it for me. WRONG. anyway when I
plug in the new SQL query into a query that I need it for I get an error or
no matches. when I plug in either of the 2 source queries I get the result
that I expect. Is there something else I need to know about using the new
query in a query that is generated by the GUI??

Steve
 
What do you mean by "plug in the new SQL query into a
query"?

You can use any query as if it were a table when creating a
new query.
 
I now have 3 queries, the 2 original ones and the new merged one. I have a
report that produced correct results (except missing a few records) when I
used Query1 and 4 other queries and tables. By substituting Query2 for
Query1 I get correct results, but now missing a different set of records. By
substituting Query3 I expected to get results with ALL the records. What I
get is “Reserved error (-3007); there is no message for this error†and no
results.

Marshall Barton said:
What do you mean by "plug in the new SQL query into a
query"?

You can use any query as if it were a table when creating a
new query.
--
Marsh
MVP [MS Access]


Steve said:
I remember enough from SQL classes 15 years ago to understand and read SQL
but I just assumed the GUI would interpret it for me. WRONG. anyway when I
plug in the new SQL query into a query that I need it for I get an error or
no matches. when I plug in either of the 2 source queries I get the result
that I expect. Is there something else I need to know about using the new
query in a query that is generated by the GUI??
 
Nobody is going to have a hope of figuring this out without
a clear explanation of what you are trying to accomplish
along with the needed tables, their fields and how they're
related.
 

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

Back
Top