Make Table & Union query

S

SusanV

Hi all,

is it possible to make a table based on a Union query in a single SQL
statement? Or must I create the table first then append each piece of the
union query? (I don't want to store the union query)

TIA,

Susan
 
B

Brian Camire

You might try something like:

SELECT
*
INTO
[Destination Table]
FROM
(SELECT
[Origin Table 1].[Field 1],
[Origin Table 1].[Field 2]
FROM
[Origin Table 1]
UNION SELECT
[Origin Table 2].[Field 1],
[Origin Table 2].[Field 2]
FROM
[Origin Table 2])
 
S

SusanV

Thanks Brian - I'll give that a try.

Brian Camire said:
You might try something like:

SELECT
*
INTO
[Destination Table]
FROM
(SELECT
[Origin Table 1].[Field 1],
[Origin Table 1].[Field 2]
FROM
[Origin Table 1]
UNION SELECT
[Origin Table 2].[Field 1],
[Origin Table 2].[Field 2]
FROM
[Origin Table 2])


SusanV said:
Hi all,

is it possible to make a table based on a Union query in a single SQL
statement? Or must I create the table first then append each piece of the
union query? (I don't want to store the union query)

TIA,

Susan
 

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

Top