查询不重复的用户名的最新信息

1.select tt.* from(  
select * from  comments order by theTime desc) as tt group by newsID

2.select * from comments as tt group by id,newsID,comment,theTime having
 theTime=(select max(theTime) from comments where newsID=tt.newsID)
 

原文地址:https://www.cnblogs.com/darktime/p/3083342.html