如果有10000条记录,我想选中第100条到200条,这句话如何表达呀?(access2000数据库)
adoquery3.close;
adoquery3.sql.clear;
ADOQUERY3.SQL.ADD('select * from bhk where (recordno>99 and recordno<201) order by xsbh');
adoquery3.Open;
这句话不行,应该怎么改呀

解决方案 »

  1.   

    select Top 100 * from (select * from bhk where *** not in (select top 100 *** from bhk ) )*** 唯一标识
      

  2.   

    select * from (
    select
    (select count(*) as dd 
    FROM [bhk] as a  where a.[id]<b.[id]) AS RowNo, b.*
    FROM [bhk] as b) awhere RowNo between 100 and 200
      

  3.   

    在sql里的字段里设置一个id字段,这个字段不是自己争加的那种,写语句让它有规律的增加,如果连续的id中有的被删除就让它补充。
      那你就可以里用这个id去选中你想要的记录。
      

  4.   

    那么有谁知道吗?
    如果我想取数据表的最后50条记录应该怎么写呀?
    adoquery3.close;
    adoquery3.sql.clear;
    ADOQUERY3.SQL.ADD('select bottom 50 * from bhk ');
    adoquery3.Open;
    这样可以吗?
      

  5.   

    'select * from bhk order by xsbh desc
      

  6.   

    select top 100 *** from bhk
      

  7.   

    select Top 100 * from 
    (select Top 200 * from bhk 
      where *** not in (select top 100 *** from bhk ) )