谁能在给定的sql语句中发现错误吗? [重复]

问题描述 投票:0回答:1
select top 1 * from kali_node where nstatus='pending';

我正在使用EditLine包装器,对于Linux(x86_64)使用mysql Ver 14.14 Distrib 5.7.30,

执行上述语句时,出现以下错误:

ERROR 1064 (42000): 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 '1 * from kali_node where nstatus='pending'' at line 1

请告诉我是否需要提供更多信息。

mysql mysql-error-1064
1个回答
1
投票

并非所有数据库系统都支持SELECT TOP子句。 MySQL支持LIMIT子句来选择数量有限的记录,而Oracle使用ROWNUM。

所以您的代码应该是:

select * from kali_node where nstatus='pending' limit 1;
© www.soinside.com 2019 - 2024. All rights reserved.