【问题标题】:SELECT TOP error选择顶部错误
【发布时间】:2013-07-04 10:17:33
【问题描述】:

我有这个 mySQL 脚本:

SELECT TOP 2 * FROM produse ORDER BY `id_produs` DESC

产生这个错误:

#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 '2 * FROM produse ORDER BY `id_produs` DESC LIMIT 0, 30' at line 1

有什么问题?

【问题讨论】:

  • 在手册中查找这个有多难?

标签: mysql sql database select


【解决方案1】:

mysql中没有TOP

使用 LIMIT 2

   SELECT * FROM produse ORDER BY id_produs DESC LIMIT 2

【讨论】:

    【解决方案2】:

    改用LIMIT

    SELECT * 
    FROM   produse
    ORDER  BY id_produs DESC
    LIMIT  2
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-08
      • 1970-01-01
      • 1970-01-01
      • 2019-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多