分组再分页查询

不废话了,实现如下:

select g.gid,g.nam,t.nams from(select no = ROW_NUMBER() over (partition by gid  order by ode desc),* from gods) as g   left join godsType as t on t.Id = g.gid
 where no between 0 and 15 and t.id in (select id from GodsType where [Type]='mt')
order by g.gid,no

这样就ok了

你可能感兴趣的:(分页分组)