By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,602 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,602 IT Pros & Developers. It's quick & easy.

Does MySQL (4.0.20-standard) allow subqueries???

P: n/a
Im moving a development app (MySQL 5.0) to a different server which
runs MySQL 4.0.20-standard. I am getting errors on queries that have
subqueries such as...

SELECT id
FROM table1
WHERE id IN (
SELECT id FROM table1
)

Seems like such a simple query but it wont run? Anybody know the
answer and what other limitations im going to experience going from
version 5.0 down to 4.0.20-standard. -Nick
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Nick wrote:
Im moving a development app (MySQL 5.0) to a different server which
runs MySQL 4.0.20-standard. I am getting errors on queries that have
subqueries such as...

SELECT id
FROM table1
WHERE id IN (
SELECT id FROM table1
)

Seems like such a simple query but it wont run? Anybody know the
answer and what other limitations im going to experience going from
version 5.0 down to 4.0.20-standard. -Nick


Subqueries are not supported in 4.0.x but will be in 4.1.x

The manual's always a good start for finding out what is and is not
available in MySQL.

This page has a feature list of what's in 4.0.x
http://dev.mysql.com/doc/mysql/en/Nu..._features.html

This page has a feature list of what's in 4.1.x
http://dev.mysql.com/doc/mysql/en/Nu..._features.html

This one has planned features for 5.0
http://dev.mysql.com/doc/mysql/en/TODO_MySQL_5.0.html

By reading each of those and comparing, you'll be able to see what the
difference between them is.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 20 '05 #2

P: n/a
Nick wrote:
Seems like such a simple query but it wont run? Anybody know the
answer and what other limitations im going to experience going from
version 5.0 down to 4.0.20-standard. -Nick


Subqueries are not supported in version 4.0.x of MySQL.
MySQL 4.1 introduced support for subqueries.

See:
http://dev.mysql.com/doc/mysql/en/AN...ubqueries.html

And here's a page to help rewriting some types of subqueries as joins:
http://dev.mysql.com/doc/mysql/en/Re...ubqueries.html

There are many, many changes between 4.0 and 5.0. I cannot guess what
features you are using that were introduced after 4.0.

Try starting here: "C. MySQL Change History"
http://dev.mysql.com/doc/mysql/en/News.html

Regards,
Bill K.
Jul 20 '05 #3

P: n/a
There is a paper on mysql explaining the work around for subqueries.
SELECT id
FROM table1
WHERE id IN (
SELECT id FROM table1
)

this for example, even in mysql 5.0 I would run as

Select a.id
From table1 a, table1 b
Where a.id = b.id
Jul 20 '05 #4

P: n/a
Great...... Anyone know of a good webhost that offers MySQL 4.1+ or
Postgres??? This is going to add alot of time to the project.

-Nick
Jul 20 '05 #5

P: n/a
Nick wrote:
Great...... Anyone know of a good webhost that offers MySQL 4.1+ or
Postgres??? This is going to add alot of time to the project.


There is unlikely to be any who have MySQL 4.1 yet because it's still in
beta. And there certainly won't be any hosts with 5.0 because that's alpha
software. If your main problem is subqueries you can often rewrite them
using joins, or use code to create the in() part of the clause (a little
slow, I know). Otherwise, there are plenty of hosts with Postgres - do a
Google search on --> hosting postgres <-- and look at all the sponsored
links.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.