使用limit
如语句select top 5 * from tables;在mysql中可以这么写
select  * from tables limit 5 ;

解决方案 »

  1.   

    难道这样不行吗
    select  * from news limit 5 order by Id desc
      

  2.   

    当然可以.
    LIMIT子句的说明:
    LIMIT子句可以被用来限制SELECT语句返回的行数.LIMIT取1个或2个数字参数,如果给定2个参数,第一个指定要返回的第一行的偏移量,第二个指定返回行的最大数目.初始行的偏移量是0(不是1).
      

  3.   

    可是我为什么行不通呢?
    提示错误:Check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 5 news  order by Id desc' at line 1
      

  4.   

    刚才复制错了。提示错误:Check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by Id desc' at line 1
      

  5.   

    select  * from news order by Id desc limit 5