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

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)
 

posted @ 2013-05-17 11:25  河边的老牛  阅读(108)  评论(0编辑  收藏  举报