Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

Modify query

How can I modify query to make table from union query.

I should use only 1 query (I know how to do it in 2 queries, I need to do it in 1 query)

SELECT [Insurance Payees].*
FROM [Insurance Payees]
UNION SELECT [Tax Payees].*
FROM [Tax Payees];
0
maximyshka
Asked:
maximyshka
  • 5
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I don't think you can.  You need to save the UNION query as a named query, then create a MakeTable query from that ...

mx
0
 
maximyshkaAuthor Commented:
That I know myself.  So Answer is not possible?
0
 
answer_dudeCommented:
This should work:
SELECT MyUnion.* INTO zzMyNewTable
FROM 
(SELECT [Insurance Payees].*
FROM [Insurance Payees]
UNION SELECT [Tax Payees].*
FROM [Tax Payees]) as MyUnion

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
That does seem to work, technically not a UNION query by itself.  But it is one query.

mx
0
 
answer_dudeCommented:
It is a make table query based on a union query - done in one statement and saved as one Query object in Access - which answers the question asked.
0
 
answer_dudeCommented:
It is a make table query based on a union query - done in one statement and saved as one Query object in Access - which answers the question asked.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I see that ... and it's a cool solution.

mx
0
 
answer_dudeCommented:
It is a make table query based on a union query - done in one statement and saved as one Query object in Access - which answers the question asked.
0
 
answer_dudeCommented:
apologies for the annoying-multiple posts...  made update from phone and it posted several times

:-(

won't do that again...
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now