I'm trying to do a nested select from the mysql command prompt but i just keep getting hit with a syntax error even though I can see nothing wrong with this query:
SELECT * FROM Resident_Details WHERE GP_ID IN (SELECT GP_ID FROM GP_Details WHERE GP_name = DR Alder);
Any ideas?
cheers
Whats wrong with this Mysql syntax?
Moderator: General Moderators
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: Whats wrong with this Mysql syntax?
Without seeing the error, I can only guess, but I think the error is in missing quote around the name. Try this
Code: Select all
SELECT * FROM Resident_Details WHERE GP_ID IN (SELECT GP_ID FROM GP_Details WHERE GP_name = 'DR Alder');Re: Whats wrong with this Mysql syntax?
The doesn't work either the error is
ERROR 1064: You have an error in you SQL syntax. Check the manual that corresponds to your mysql server version for the right syntax to use near 'SELECT GP_ID FROM GP_Details WHERE GP_name = 'DR Aulder')' at li
ERROR 1064: You have an error in you SQL syntax. Check the manual that corresponds to your mysql server version for the right syntax to use near 'SELECT GP_ID FROM GP_Details WHERE GP_name = 'DR Aulder')' at li
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: Whats wrong with this Mysql syntax?
What MySql version are you working with?
Re: Whats wrong with this Mysql syntax?
4.0.15 I guess this version does not support nested selects!!!
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: Whats wrong with this Mysql syntax?
Subqueries are supported with MySql version >= 4.1. You'll have to rewrite your query.