谁能告诉我,怎么用sql语句筛选一张表里某个字段的第3条记录?(100分)

  • 主题发起人 主题发起人 verybad_boy
  • 开始时间 开始时间
V

verybad_boy

Unregistered / Unconfirmed
GUEST, unregistred user!
谁能告诉我,怎么用sql语句筛选一张表里某个字段的第3条记录?
 
什么意思?不明白。
 
您的意思是要第三条记录,对吧?
 
我是要把一个字段的前三条记录,分别取出。
第一个用select first[] from []
但怎么提取第二、第三条记录?
 
select top 3 * from tableName,
在next ,next两次就搞定了.如果想一次搞定,就使用Cursor.
 
to :DiamondKing
我就是不想用游标,不想生成数据集后再操作,所以才问的这个问题
 
楼上已经说了。
 
他说的不对呀
 
假设排序的字段名为ID,表名为Buyin
select top 1 * from buyin order by id
select top 1 * from buyin where id not in (select top 1 id from buyin order by id)
select top 1 * from buyin where id not in (select top 2 id from buyin order by id)
 
好,不错,厉害~!shiny的方法可以用!
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
505
import
I
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部