SQL:找出我(uid=2)所有的好友信息,和这些好友发布的最新的一篇文章

select f.fid, u.nick_name, u.uname, u.icon ,t.content, t.add_time 
from friends f, user u , (select content, add_time,uid from topic order by add_time desc) t 
where f.uid = 2 
and f.fid = u.id 
and t.uid = f.fid 
group by f.fid 
order by f.add_time desc

 

posted @ 2013-05-29 11:06  王翔(kingfly)  阅读(242)  评论(0编辑  收藏  举报