Jump to content

Archived

This topic is now archived and is closed to further replies.

skiplogic

subqueries

Recommended Posts

I am tearing my hair out! Any help would be appreciated!

Here's some valid SQL that wont run on my local (osx) install of mysql 5:

yo-mamas-Computer:~/buthu/linkback bryan$ mysql -V
mysql  Ver 14.12 Distrib 5.0.24a, for apple-darwin8.6.0 (powerpc) using readline 5.0
yo-mamas-Computer:~/buthu/linkback bryan$ mysql test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 38 to server version: 4.0.24-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
<b>
mysql> select 1 from (select 1 from dual) b;
ERROR 1064 (00000): You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 1 from dual) b' at line 1
</b>

But it works on the BSD box, which is apparently running an older version of mysql

-bash-2.05b$ mysql -V
mysql  Ver 14.7 Distrib 4.1.19, for portbld-freebsd5.4 (i386) using  4.3
-bash-2.05b$ brydev
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 793946 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
<b>
mysql> select 1 from (select 1 from dual) b;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)</b>

What gives?

Share this post


Link to post
Share on other sites
[quote author=fenway link=topic=107577.msg432076#msg432076 date=1157983462]
How?
[/quote]

mysql -V prints the version of the client software, not the version. If you look at the login messages from each of the spools that I quoted above, you'll notice that the bsd box is running v 5, while the osx is running v 4. I guess subqueries weren't added until after 4...

Share this post


Link to post
Share on other sites
Ah yes, I see that now... version 4.0.24; subquery support was added in 4.1+.

Share this post


Link to post
Share on other sites
the dual table wasn't added by default until after version 4 either. I thought since I could select off of it the server version must have been 5 on the osx box, but I must have created it some time ago, heh.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.