Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error with subqueries - mysql v4

Status
Not open for further replies.

snakeeyes1978

Programmer
Jan 11, 2005
70
0
0
AU
Really lost here.. Here is my SQL statement:

SELECT count(*) FROM tblcomps_clans c, tblcomps_competitions comp WHERE c.clanid = '3' AND c.clanid + comp.competitionid <> ANY (SELECT clanid + competitionid FROM tblcomps_entries WHERE clanid = '3');

These fields exist in the database:
tblcomps.clanid
tblcompetitions.competitionid
tblentries.entryid
tblentries.clanid
tblentries.competitionid

What i'm trying to do is select the number of competitions the the clan has not entered into. I am lost to why this statement is coming back with errors. The error returned is:

MySQL said: Documentation
#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 clanid + competitionid FROM tblcomps_entries WHERE clan

The manual says:

The word SOME is an alias for ANY. Thus, these two statements are the same:

SELECT s1 FROM t1 WHERE s1 <> ANY (SELECT s1 FROM t2);
SELECT s1 FROM t1 WHERE s1 <> SOME (SELECT s1 FROM t2);


Any help here would be greatly appreciated.
 
Which MySQL version are you using? Subqueries were not available until v. 4.1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top