Make Table & Union query

  • Thread starter Thread starter SusanV
  • Start date Start date
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
 
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])
 
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
 
Back
Top