简体   繁体   English

“ WHERE” 2附近的SQL语法错误

[英]SQL syntax error near “WHERE” 2

Query: 查询:

select distinct R1.name, R2.name
from (
    (
    select Ra.mID mID, Re.rID rID, Re.name name
    from Rating Ra join Reviewer Re using (rID)
    ) R1
    ,
    (
    select Ra.mID mID, Re.rID rID, Re.name name
    from Rating Ra join Reviewer Re using (rID)
    ) R2
where R1.mID = R2.mID and R1.rID > R2.rID;

Result: 结果:

Query failed to execute: near "where": syntax error

I am guessing the problem has something to do with the pointer variables in the FROM clause that are referred to in the WHERE clause, but I can't figure it out. 我猜想问题与WHERE子句中引用的FROM子句中的指针变量有关,但我无法弄清楚。 I haven't been very wary of my WHEREs recently... 我最近对我的位置不是很警惕...

There is a mismatch in the number of opening and closing brackets in the provided SQL. 提供的SQL中的左括号和右括号的数量不匹配。

There may also be other issues, but that's less clear without knowing what db server / version you are running. 可能还存在其他问题,但是在不知道您正在运行的数据库服务器/版本的情况下不清楚。

Check your php version as your query is perfect. 检查您的php版本,因为您的查询是完美的。 It may possible because some php version is not supporting sub query. 可能是因为某些php版本不支持子查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM