2,718
社区成员
发帖
与我相关
我的任务
分享
Select *,Recno() As JL Into Cursor T1 From 表名
Select * From T1 Where JL In (Select JL+1 From T1 Where Value=116)
--如果你的ID就是从1开始,并连续的:
Select * From 表名 Where Id In (Select Id+1 From 表名 Where Value=116)
或
Select A.* From 表名 A Left Join 表名 B On A.Id=B.Id+1 Where B.Value=116
Select Id,Count(*) As 次数 From 表名 Group By Id
Create Cursor T3 (MyNum C(1)) --建个表,内容为0-9,为了后面统计用
Insert Into T3 Values ("0")
Insert Into T3 Values ("1")
Insert Into T3 Values ("2")
Insert Into T3 Values ("3")
Insert Into T3 Values ("4")
Insert Into T3 Values ("5")
Insert Into T3 Values ("6")
Insert Into T3 Values ("7")
Insert Into T3 Values ("8")
Insert Into T3 Values ("9")
--得出某一条件Value=116的下一条记录
Select *,Recno() As JL Into Cursor T1 From 表名
Select * From T1 Where JL In (Select JL+1 From T1 Where Value=116)
--得出条件Value=116记录中的数字出现次数
Select A.MyNum,Sum(Occurs(A.MyNum,B.Value)) As 次数 From T3 A,T2 B Group By MyNum