56,679
社区成员
发帖
与我相关
我的任务
分享
select t2.tid, t3.tname, t2.sid, t4.sname, t2.`time`
from
(
select t1.*,(select count(1)+1 from m表
where uid=1 and tid=t1.tid and `time`>t1.`time`) as order_number
from m表 t1
where t1.uid=1
) t2, t表 t3, s表 t4
where t2.tid=t3.tid and t2.sid=t4.sid and t2.order_number<=3
order by t2.tid desc,t2.order_number;