Jump to content


Photo

MySql syntax error


  • Please log in to reply
3 replies to this topic

#1 ryland22

ryland22
  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationUS

Posted 26 September 2003 - 04:08 PM

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?

#2 PHPcadet

PHPcadet
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationPlant City, Florida

Posted 26 September 2003 - 05:06 PM

From my understanding of the MySQL manual, the IN clause can only contain values within the parentheses. See
http://www.mysql.com..._Operators.html
for an expalnation.
If builders built buildings the way programmers write programs, then the first termite to come along would destroy civilization -- Anonymous

#3 ryland22

ryland22
  • New Members
  • Pip
  • Newbie
  • 8 posts
  • LocationUS

Posted 27 September 2003 - 03:56 AM

Yes, after some searching I found that only Mysql version 4+ will allow subqueries and my webhost is running Mysql 3+.

#4 PHPcadet

PHPcadet
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationPlant City, Florida

Posted 27 September 2003 - 12:27 PM

Specifically in MySQL version 4.1, which is in alpha testing right now, you will be able to do subqueries.
If builders built buildings the way programmers write programs, then the first termite to come along would destroy civilization -- Anonymous




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users