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
请告诉我是否需要提供更多信息。
并非所有数据库系统都支持SELECT TOP子句。 MySQL支持LIMIT子句来选择数量有限的记录,而Oracle使用ROWNUM。
所以您的代码应该是:
select * from kali_node where nstatus='pending' limit 1;