MySQL Forums
Forum List  »  Newbie

subqueries with "IN" do not work for me?
Posted by: Chris Haag
Date: August 22, 2004 12:02PM

Based on this page:
http://dev.mysql.com/doc/mysql/en/ANY_IN_SOME_subqueries.html

and this statement:
SELECT s1 FROM t1 WHERE s1 IN (SELECT s1 FROM t2);

I expected the following 2 statements to work from the mysql CL:

mysql> select id from users where id in (select uid from group_users);
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select uid from group_users)' at line 1

#or more simply

mysql> select 7 in (select 7);
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 7)' at line 1

#interestingly this does work

mysql> select 7 in (6, 7);
+-------------+
| 7 in (6, 7) |
+-------------+
| 1 |
+-------------+
1 row in set (0.00 sec)


My install details
mysql Ver 12.22 Distrib 4.0.18, for sun-solaris2.8 (sparc)

Is this suppoed to work? Any advice would be appreciated.

Options: ReplyQuote


Subject
Written By
Posted
subqueries with "IN" do not work for me?
August 22, 2004 12:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.