select * from #t1 a where not exists(select 1 from #t1 where title=a.title and adddate>a.adddate)
select a.title,a.username,b.adddate from #t1 a,(select max(adddate) as adddate from #t1 where title=a.title as ...),b
--应该是这样吧!select a.title,a.username,b.adddatefrom #t1 a join (select title,max(adddate) as adddate from #t1 group by title) b on a.adddate=b.adddate
select top 1 title,username,addate from #t1 order by adddate desc
mschen(发光的星星) 是正解 select a.title,a.username,(select max(adddate) adddate from #t1 where title=a.title) as adddate from #t1 a group by a.title,a.username 應該也可以
select a.title,a.username.b,b.adddate from a join (select title,max(adddate) as adddate from a group by title) as b on a.title=b.title
select a.title,a.username,(select max(adddate) from #t1 where title=a.title) as adddate from #t1 a
select a.title,a.username.b,b.adddate from #t1 a join (select title,max(adddate) as adddate from #t1 group by title) as b on a.title=b.title
from #t1 a
where not exists(select 1 from #t1 where title=a.title and adddate>a.adddate)
from #t1 a,(select max(adddate) as adddate from #t1 where title=a.title as ...),b
from #t1
group by title) b
on a.adddate=b.adddate
select top 1 title,username,addate from #t1 order by adddate desc
select a.title,a.username,(select max(adddate) adddate from #t1 where title=a.title) as adddate
from #t1 a group by a.title,a.username
應該也可以
from a join (select title,max(adddate) as adddate
from a
group by title) as b
on a.title=b.title
from #t1 a
from #t1 a join (select title,max(adddate) as adddate
from #t1
group by title) as b
on a.title=b.title