select top 1 * from kali_node where nstatus='pending';
我使用的是mysql版本14.14 Distrib 5.7.30,for Linux(x86_64),使用的是EditLine包装器。
当我执行上述语句时,我得到以下错误:
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;