RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
At 10:19 am 14/08/03, Jim Smith wrote: I repeat. Why do you need the parentheses? Union queries don't require them. Sorry, missed this. They do need them if you want to use ORDER BY on the result of the UNION. Jim -- James Fryer / [EMAIL PROTECTED] / [EMAIL PROTECTED] -- MySQL General

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Nils Valentin
James Fryer wrote: At 10:17 am 14/08/03, Nils Valentin wrote: The simple answer would be that the syntax says: http://www.mysql.com/doc/en/UNION.html SELECT... UNION... SELECT... Further down the page it says If you want to use an ORDER BY for the total UNION result, you should use

RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Jim Smith
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

RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Jim Smith
Are you saying that any query containing parentheses fails? In that case sub selects won't work either. -Original Message- From: James Fryer [mailto:[EMAIL PROTECTED] Sent: 14 August 2003 10:07 To: [EMAIL PROTECTED] Subject: RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
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

RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
At 09:47 am 14/08/03, Jim Smith wrote: But why do you need the parentheses? This was a simplified query for example purposes. The real query looks more like (SELECT ...) UNION (SELECT ...) ORDER BY ... I could rewrite this with subselects but I have found them to be slower. My question is,

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Nils Valentin
Hi James, The simple answer would be that the syntax says: http://www.mysql.com/doc/en/UNION.html SELECT... UNION... SELECT... And thats all there is to it ;-) ... perhaps... Exception: The only reason to use the parenthis would be with ORDER BY (as you do), but than you will need to use

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Sergei Golubchik
Hi! On Aug 14, James Fryer wrote: At 10:28 am 14/08/03, Sergei Golubchik wrote: It's in the 4.0.14 changelog, and thus, is available in 4.0.14 Hmm, I am using Ver 13.5 Distrib 4.1.0-alpha, for apple-darwin6.4 (powerpc) which I should have said in the first place, sorry. So it ought

RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Jim Smith
Sorry, missed this. They do need them if you want to use ORDER BY on the result of the UNION. Only if you are also ordering the component parts of the union. This works create table y select * from x union select * from x order by 1 desc but this doesn't create table y select *

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
At 10:28 am 14/08/03, Sergei Golubchik wrote: It's in the 4.0.14 changelog, and thus, is available in 4.0.14 Hmm, I am using Ver 13.5 Distrib 4.1.0-alpha, for apple-darwin6.4 (powerpc) which I should have said in the first place, sorry. So it ought to be working?!? Jim -- James Fryer /

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Nils Valentin
Hi James, 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

RE: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
At 10:19 am 14/08/03, Jim Smith wrote: Are you saying that any query containing parentheses fails? No. Any query beginning with a SELECT statement in parentheses. Jim -- James Fryer / [EMAIL PROTECTED] / [EMAIL PROTECTED] -- MySQL General Mailing List For list archives:

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Nils Valentin
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

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread Sergei Golubchik
Hi! On Aug 14, James Fryer wrote: Assuming a legal SELECT statement, this works fine: CREATE TABLE Foo SELECT ... but this does not: CREATE TABLE Foo (SELECT ...) This is a problem for me as I'd like to use the output of a SELECT...UNION...ORDER BY statement as input to CREATE

Re: CREATE TABLE, INSERT INTO with SELECT in parentheses

2003-08-14 Thread James Fryer
At 10:17 am 14/08/03, Nils Valentin wrote: The simple answer would be that the syntax says: http://www.mysql.com/doc/en/UNION.html SELECT... UNION... SELECT... Further down the page it says If you want to use an ORDER BY for the total UNION result, you should use parentheses: (SELECT a FROM