But why do you need the parentheses?

What is wrong with 

CREATE TABLE Foo2
        SELECT * FROM sensei 
        WHERE last_name IN (SELECT last_name 
                                  FROM sensei UNION ALL
                                  select last_name 
                                  FROM sensei) 
      ORDER BY e_mail;
 

> -----Original Message-----
> From: James Fryer [mailto:[EMAIL PROTECTED]
> Sent: 14 August 2003 09:41
> To: [EMAIL PROTECTED]
> Subject: Re: CREATE TABLE, INSERT INTO with SELECT in parentheses
> 
> 
> At 09:22 am 14/08/03, Nils Valentin wrote:
> >I don' t understand your question. Why do you hink you that 
> the brackets
> >would't work ?
> >
> >I tried that without any problems. Please post your code.
> >
> >Here is mine:
> >
> >SELECT * FROM sensei WHERE last_name IN (SELECT last_name 
> FROM sensei UNION
> >ALL select last_name FROM sensei) ORDER BY e_mail;
> 
> Here's some code that demonstrates what I mean:
> 
> ------ Cut Here ------
> CREATE DATABASE Foobar;
> USE Foobar;
> CREATE TABLE Bar (id int(10) unsigned);
> 
> # Works
> SELECT * FROM Bar;
> 
> # Works
> CREATE TABLE Foo1 SELECT * FROM Bar;
> 
> # Works
> (SELECT * FROM Bar);
> 
> # Fails (syntax error)
> CREATE TABLE Foo2 (SELECT * FROM Bar);
> 
> DROP DATABASE Foobar;
> ------ Cut Here ------
> 
> Using MacOS so please forgive any errors due to case-sensitivity.
> 
> Jim
> -- 
> James Fryer  /  [EMAIL PROTECTED]  /  [EMAIL PROTECTED]
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to