一条SQL语句的疑问
表如下:
id memberID
12 6
13 7
14 7
15 7
16 8
17 8
18 9
id为自增,要求根据memberID拿出每人最近三条记录,如果超过三条也拿三条,低于三条只拿一条
---------
create table #i(id int,memberid int)
insert into #i values(12,6)
insert into #i values(13,7)
insert into #i values(14,7)
insert into #i values(10,7)
insert into #i values(15,7)
insert into #i values(16,8)
insert into #i values(17,8)
insert into #i values(18,9)
insert into #i values(19,7) &nbs