I use php 4.1.1. mysql 3.23.49 and phpmyadmin 2.5.4

 

I have two tables

 

classes

------------

- class_id (int)

- class_name (text)

----------------------------

HS

HD

DD

DS

MD

 

champions

----------------

- champions_id (int)

- year (text)

- class_name (text)

- winner (text)

----------------------------

1981 HS PETER

1981 DS ANNE

 

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?

 

 

 

 

Reply via email to