一张表有十万数据,字段名为a,b,c, 如果a字段的属性值样,就查找它的前五行,求解高手……
------解决方案--------------------
- SQL code
select tt.a,tt.b,tt.numfrom (select t.a,t.b,ROW_NUMBER() over(partition by t.a order by t.a) numfrom test tgroup by t.a,t.b)ttwhere tt.num < 6
select tt.a,tt.b,tt.numfrom (select t.a,t.b,ROW_NUMBER() over(partition by t.a order by t.a) numfrom test tgroup by t.a,t.b)ttwhere tt.num < 6