UNION ALL 关键字连接两个表的数据,相同表会合并但不会去重 UNION 会将相同数据的行去重
select
*
from articlewhere article_category
where article_category=2 or article_category=3
order by article_id desclimit 5
解决方案:避免使用in 或者 or (or会导致扫表),使用union all
(select * from article where article_category=2 order by article_id desc limit 5)
UNION ALL
(select * from article where article_category=3 order by article_id desc limit 5)
ORDER BY article_id desclimit 5