Her er en løsning:
CREATE TABLE AS
SELECT *
FROM (
SELECT ...
UNION ALL
SELECT ...
) AS foo
Du kan ikke oprette foreningen direkte for create table
, men du kan gøre det til et undervalg:
mysql> create table foo as (select * from ((select 'foo') union all (select 'bar')) as foo);
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0