[prog] MySQL & 'IN'
Karine Proot
kproot at nerim.net
Sat Jul 17 16:17:11 EST 2004
Hello,
I just can't manage to understand what I'm doing wrong with my query.
Here it is, with error output (sorry for the unpronouncable column
names):
Error
SQL-query :
SELECT sbt_id
FROM subtypes
WHERE sbt_id
IN (
SELECT tst_id_sbt AS sbt_id
FROM types_subtypes
)
LIMIT 0 , 30
MySQL said:
#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 tst_id_sbt AS sbt_id
FROM types_subtypes ) LIMIT 0, 30'
First I thought maybe 'IN' was not understood by mysql, but phpmyadmin
shows the query nicely indented and colored, and the doc says otherwise
and gives a nice example:
SELECT s1 FROM t1 WHERE s1 IN (SELECT s1 FROM t2);
Where is the difference ?
(My query is simplified because I was doing some testing on that error,
I know the IN isn't useful there, but for the real query it is!)
Thanks
Karine
More information about the Programming
mailing list