select top 200 * from xxx

解决方案 »

  1.   

    select top 200 * from xxx
    在Mysql数据库里好象不能用~
      

  2.   

    select * from tb1 where rownum<200 order by rownum;执行这条语句,即可从数据库中取出200条记录!
      

  3.   

    请问 ningIII(小宁)
    rownum是什么啊?数据库里的字段还是?
    select * from tb1 where rownum<200 order by rownum;
    上面那句话我不太明白,能解释一下吗?谢谢了!
      

  4.   

    rownum是伪列也就是数据库内部行号,他会自动给记录排序的!从1开始!
      

  5.   

    我的数据库中的表是Gb_Content 用的是MySQL数据库
    我执行
    select * from Gb_Content where rownum<200 order by rownum;他报错!
    ERROR 1054 Unknown column 'rownum' in 'where clause'
      

  6.   

    mysql没用过可能没有伪列!说说我的思路,将整个记录集取出来,进行分页;页面跳转时再去查数据库,保持与数据库的同步!
      

  7.   

    这个是你的web端的数据缓存器怎么做了
    你的这个缓存判断到了数据尾
    就再次读取数据
      

  8.   

    你用的什么数据库,不同的数据库Sql有不同的写法,Oracle是:select * from tab where rownum<=200 order by rownum; SQL Server 2000是:select top 200 * from tab order by col1
      

  9.   

    我上边写了,我用的是MySQL的数据库!
    MySQL数据库有这个功能吗?谢谢!:)
      

  10.   

    mysql数据库的分页是使用limit语句的.如要显示从50条记录开始的10条记录,那么就这么写:
    select * from XXtable where xxx = xx limit 49,10
    注意limit是从0开始的,所以要显示第50条,需要写成49.而且limit语句要写在整个sql的最后面才可以,否则报错
      

  11.   

    对,用limit,别的数据库还没有呢,只有mysql有,非常方便
      

  12.   

    The LIMIT Modifier
    The LIMIT modifier may be used to limit the records returned by the SELECT statement. You specify the start row (start from zero), and the number of records returned. The following example lists the first 10 records from the search table. mysql> SELECT * FROM search LIMIT 0, 10;
      

  13.   

    回复人: gsen(进入就是上帝) ( ) 信誉:100  2004-07-15 22:57:00  得分: 0  
       对,用limit,别的数据库还没有呢,只有mysql有,非常方便应该是用limit共通些,
    在postgres上也有limit