ryland22 Posted September 26, 2003 Share Posted September 26, 2003 If I write \"SELECT cust_id FROM table1 WHERE table1.cust_id IN (1203)\" I have no problems. If I write \"SELECT cust_id FROM table1 WHERE table1.cust_id IN (SELECT cust_id FROM table2)\" I receive a Sql syntax error. What am I doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/1068-mysql-syntax-error/ Share on other sites More sharing options...
PHPcadet Posted September 26, 2003 Share Posted September 26, 2003 From my understanding of the MySQL manual, the IN clause can only contain values within the parentheses. See http://www.mysql.com/doc/en/Comparison_Operators.html for an expalnation. Quote Link to comment https://forums.phpfreaks.com/topic/1068-mysql-syntax-error/#findComment-3626 Share on other sites More sharing options...
ryland22 Posted September 27, 2003 Author Share Posted September 27, 2003 Yes, after some searching I found that only Mysql version 4+ will allow subqueries and my webhost is running Mysql 3+. Quote Link to comment https://forums.phpfreaks.com/topic/1068-mysql-syntax-error/#findComment-3636 Share on other sites More sharing options...
PHPcadet Posted September 27, 2003 Share Posted September 27, 2003 Specifically in MySQL version 4.1, which is in alpha testing right now, you will be able to do subqueries. Quote Link to comment https://forums.phpfreaks.com/topic/1068-mysql-syntax-error/#findComment-3640 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.