Re: subquery fails, i don't think an outer join will work
On Thu, 20 Sep 2007 02:12:08 -0700, dino d. wrote:
> and then the query:
>
> SELECT F.description, count( * )
> FROM students S, preferences P, food F
> WHERE S.studentID
> IN (
>
> SELECT S.studentid
> FROM students S, preferences P, food F
> WHERE S.studentID = P.studentID
> AND P.foodID = F.FoodID
> AND F.description LIKE '%blueberries%'
> )
> AND S.studentID = P.studentID
> AND P.foodID = F.foodID
> GROUP BY F.foodID
>
> and the result:
>
> 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 S . studentid from students S , Preferences P , Food F
>
> the subquery by itself works fine, and if i substitute the subquery
> with a set of scalars, it also works fine.
>
> and just to make sure my version supports subqueries, here's what
> php_info says:
>
> mysql
> MySQL Support enabled
> Active Persistent Links 0
> Active Links 0
> Client API version 5.0.18
> MYSQL_MODULE_TYPE external
> MYSQL_SOCKET /tmp/mysql.sock
> MYSQL_INCLUDE -I/usr/local/mysql/include
> MYSQL_LIBS -L/usr/local/mysql/lib -lmysqlclient
>
> thanks for taking a look at this, i appreciate it.
Your client is verion 5.0.18. What version is the server? Subqueries
don't exist before version 4.1.
--
6. I will not gloat over my enemies' predicament before killing them.
--Peter Anspach's list of things to do as an Evil Overlord
|