不能用视图,用存储过程:create proc pr_Query
as
select a,b,c,IDENTITY(int,1,1) as id into # from abcselect a,b,c
from # a
where (select count(*) from # where a=a.a and id<=a.id)<=2
order by a,iddrop table #
go