每个类别提取最新一条记录
按编号来:
select max(topicid) as topicid from tb_bbs_topic
where
boardid in(6,10,34,12,33,13,18,21,51,49) group by boardid
如果是按日期来的话:
select * from tb_bbs_topic a
inner join
(
select boardid, max(dateandtime) as dateandtime
from tb_bbs_topic b
where boardid in(6,10,34,12,33,13,18,21,51,49)
group by boardid
)
b on a.boardid=b.boardid and a.dateandtime=b.dateandtime