Bug #406 Cannot use UNION in CREATE TABLE AS
Submitted: 8 May 2003 23:30 Modified: 24 Jul 2003 2:26
Reporter: Tore Eriksson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.0.11-gamma-standard OS:Other (Tru64 4.1)
Assigned to: CPU Architecture:Any

[8 May 2003 23:30] Tore Eriksson
Description:
When trying to create a table using CREATE TABLE ... AS SELECT, using a UNION clause for the select statement gives an SQL syntax error.

How to repeat:
CREATE TABLE a (
    id INT, 
    data VARCHAR(10)
);

INSERT INTO a VALUES (1, 'one');
INSERT INTO a VALUES (2, 'two');

CREATE TABLE b AS
   (SELECT data FROM a WHERE id=1)
    UNION
   (SELECT data FROM a WHERE id=2);

Suggested fix:
Extend the CREATE TABLE AS syntax to allow for UNIONs.
[23 Jul 2003 16:08] Tore Eriksson
Problem is solved in 4.0.14-standard. Thank you very much.
[24 Jul 2003 2:26] Sergei Golubchik
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/