我现在有两张表一个是论坛的主贴(topicinfo) 另一张是回帖表(updateinfo)它俩之间有外键(md5_url 主贴表的主键,回帖表的外键)主贴表还有一个status 字段 我现在想查询 满足 status 值为 1,2,3并且 回帖时间(last_reply_date记录在回帖表中)最新的10条 于是写了
select * from topicinfo where status in (1,2,3) and md5_url in (select md5_url from updateinfo order by last_reply_date)limit 10
结果 并不好 因为最先回帖的那10条记录 它们的主贴状态status 值为4 MYSQL并没有继续乡下匹配 本人SQL知识浅薄 不知道 怎么写才正确