create table tb1(
id decimal(10),
tid decimal(10),
mid decimal(10)
)
insert into tb1 values(1,1,1)
insert into tb1 values(2,2,1)
insert into tb1 values(3,3,2)
insert into tb1 values(4,4,2)
insert into tb1 values(5,5,3)
insert into tb1 values(6,6,3)
select min(id),min(tid),mid from [tb1] group by mid
drop table tb1
刚学sql server,前面的数据类型定义有些问题,但是sql是对的,已经测试通过