Click here to Skip to main content
15,068,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Error
Static analysis:

6 errors were found during analysis.

Unexpected token. (near "=" at position 127)
Unexpected token. (near "Classroom" at position 129)
Unexpected token. (near "." at position 138)
Unexpected token. (near "CaID" at position 139)
This type of clause was previously parsed. (near "LEFT JOIN" at position 144)
Unrecognized statement type. (near "LEFT JOIN" at position 144)
SQL query: Documentation

SELECT Campus.Address, COUNT(Enrolment.StudentID) AS "No of Students" FROM Campus LEFT JOIN Classroom ON Campus ON Campus.CaID = Classroom.CaID LEFT JOIN SpaceAssign ON Classroom.RmID = SpaceAssign.RmID LEFT JOIN Teach GROUP BY (Campus.CaID)

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ON Campus.CaID = Classroom.CaID LEFT JOIN SpaceAssign ON Classroom.RmID = SpaceA' at line 1

What I have tried:

Can't figure out what's wrong with this sql. I am only a beginner so please help.
Posted
Updated 6-Apr-21 2:08am

1 solution

Quote:
SQL
Campus LEFT JOIN Classroom ON Campus ON Campus.CaID = Classroom.CaID
You have an extra ON Campus in your JOIN.
Quote:
SQL
LEFT JOIN Teach
You are also missing a join condition for the Teach table.
   
v2
Comments
JCS345 6-Apr-21 8:22am
   
thank you so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900