declare @table2 table(mobile varchar(100),fee int,k int)
insert into @table2
select '13800000000',10,1
union all select '13900000000',15,7
union all select '13800000000',2,1
union all select '13800000000',5,1
union all select '13900000000',15,8
union all select '13700000000',50,6
union all select '13800000000',2,1
union all select '13700000000',50,6
select * from @table2 order by mobile
select * from @table2 group by mobile,fee,k having count(mobile)>1
insert into @table2
select '13800000000',10,1
union all select '13900000000',15,7
union all select '13800000000',2,1
union all select '13800000000',5,1
union all select '13900000000',15,8
union all select '13700000000',50,6
union all select '13800000000',2,1
union all select '13700000000',50,6
select * from @table2 order by mobile
select * from @table2 group by mobile,fee,k having count(mobile)>1
table 中有兩個字段:A,Bselect A,B
from table
group by A,B
having count(*)>1