17,377
社区成员
发帖
与我相关
我的任务
分享
create table #message(id varchar(20),receivetime varchar(10), taskid varchar(10),projectid varchar(10))
insert into #message
select 1,'2009-1-1',1,1
union all
select 2,'2009-1-2',1,1 union all
select 3,'2009-1-1',1,2 union all
select 4,'2009-1-3',2,2 union all
select 5,'2009-1-1',2,2
select *from #message a where not exists(select 1 from #message b where b.receivetime>a.receivetime and b.projectid=a.projectid)