我无法理解为什么我的mySQL会出现这种语法错误:
#1064 - 您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在' cc.cursoID = c.cursoID附近使用正确的语法JOIN cursosUsuarios cu ON c.cursoID = cu.cursoID JOIN u'在第17行
这是我的疑问:
Request: /results?auth=abc123&id=9876&start=2016-08-20&end=2016-09-01
Status: 200
Latency: 265 ms
这是第17行:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.
<br />
</p>
</body>
</html>
答案 0 :(得分:1)
你错过了“开启”。
SELECT
e.examenID, e.contenidoID, e.tituloExamen,
u.userID, u.userEmail,
cu.userID, cu.cursoID, cu.examenes, cu.examenesRendidos,
co.contenidoID, co.tituloContenido,
cc.contenidoID, cc.cursoID,
c.cursoID, c.nombreCurso
FROM examenes ex
JOIN contenidos co
ON ex.contenidoID = co.contenidoID
JOIN cursosContenidos cc
ON co.contenidoID = cc.contenidoID
JOIN cursos c
ON cc.cursoID = c.cursoID
JOIN cursosUsuarios cu
ON c.cursoID = cu.cursoID
JOIN usuarios u
ON cu.userID = u.userID
WHERE
cu.cursoID = 15 AND
cu.userID = 1
答案 1 :(得分:0)
第17行应
JOIN cursos c ON cc.cursoID = c.cursoID
您忘记在加入时添加“ON”。