"Carl Sch?le, IT, Posten" <[EMAIL PROTECTED]> wrote:
> I use php 4.1.1. mysql 3.23.49 and phpmyadmin 2.5.4
[skip]
> What I want to do is to list all class_name from classes that aren't represented a
> specific year.
>
> So what I want as result is HD, DD, MD
>
> I'm trying to use the following query:
>
>
> SELECT class_name FROM classes WHERE NOT EXISTS (SELECT * FROM champions WHERE
> champions.class_name=classes.class_name AND champions.year='1981')
>
>
> ERRORREPORT:
>
> #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 'EXISTS (
>
> SELECT *
>
> FROM champions
>
> WHERE champions.class_name
>
>
> Someday please help me. Am I not using the right version of php? Or is it mysql?
Your version of MySQL doesn't support sub-selects. Subqueries are supported from
version 4.1.0. You can rewrite the above query using LEFT JOIN:
http://www.mysql.com/doc/en/Rewriting_subqueries.html
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]