--借助臨時表吧
select id=identity(int,1,1),*
into #
from testb select A.t1,A.t2,A.t3,A.t4,A.t5,A.t6
from # A
inner join
(select t3,t4,t5,min(id) as id
from #
group by t3,t4,t5) B
on A.id=B.id
select id=identity(int,1,1),*
into #
from testb select A.t1,A.t2,A.t3,A.t4,A.t5,A.t6
from # A
inner join
(select t3,t4,t5,min(id) as id
from #
group by t3,t4,t5) B
on A.id=B.id
但是如果不能临时表可以吗?就只用SQL语句行吗?