Page 1 of 1

Help with nested sql-query

Posted: Sat Oct 09, 2004 8:02 am
by tores
Hi

This nested query gives me a syntax error:
SELECT starttime, duration FROM mos_poly_activities WHERE actID = (SELECT lastactivity FROM mos_poly_lines WHERE linename = 'nettlinje');

But if I run the same two queries independently with the outer query using the result from the inner one, everything is ok.
The final result is an empty set, but that shouldn't effect the nested query I think.

Anyone know how to fix this error?

Regards tores

Posted: Sat Oct 09, 2004 8:07 am
by twigletmac
Database software? and version?

Mac

Posted: Sat Oct 09, 2004 8:09 am
by tores
Sorry. Forgot to include it in the last post.

I'm using mysql 4.0.20a-debug

Posted: Sat Oct 09, 2004 8:11 am
by twigletmac
That's the issue then, subqueries are only supported from MySQL 4.1:
http://dev.mysql.com/doc/mysql/en/Subqueries.html

Mac