此查询实际上与我显示的工作示例相同:
SELECT * FROM entities.entities WHERE entities.entities.id = (SELET MAX(entities.entities.id) FROM entities.entities);这个查询开始时要简单得多,但我一直在添加数据库和表名,以确保查询无可挑剔。
它产生了不那么有用的错误:
SQL错误(1064):您的SQL语法中有错误; 检查与MySQL服务器版本对应的手册,以便在第3行使用“MAX(id)FROM entities”附近的正确语法
我已经确定我有MySQL版本5+,我已经确保子查询是一个标量子查询,即它只返回一行有一行,并且在查询的WHERE部分中受支持。
我觉得它没有错。
进入专家!
This query is virtually identical to the working example I was shown:
SELECT * FROM entities.entities WHERE entities.entities.id = (SELET MAX(entities.entities.id) FROM entities.entities);This query was much simpler to begin with, but I've been adding database and table names everywhere just to be certain the query is impeccable.
It produces the not-so-helpful error:
SQL Error (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 'MAX(id) FROM entities)' at line 3
I've made sure I have MySQL version 5+, I've made sure the subquery is a scalar subquery, that is it returns only one column with one row, and is supported in the WHERE section of the query.
I see nothing wrong with it.
Enter the experts!
最满意答案
您的代码应为:
SELECT * FROM entities.entities WHERE entities.entities.id = (SELECT MAX(entities.entities.id) FROM entities.entities);(你拼错了“SELECT”作为“SELET。”)
Your code should read:
SELECT * FROM entities.entities WHERE entities.entities.id = (SELECT MAX(entities.entities.id) FROM entities.entities);(You had misspelled "SELECT" as "SELET.")
更多推荐
发布评论