从多张表中取数据做分页

文章目录

  • 方案1 union all

方案1 union all

select row_id,title,ctime,app from (
select topic_id as row_id,title ,ctime,'bbs' as app from qm_bbs_topic where is_del = 0 
union all 
select wiki_id as row_id,title,ctime,'wiki' as app from qm_wiki where is_del =0  
union all 
select topic_id as row_id ,title ,ctime ,'team_bbs' as app from qm_team_forum_topic where is_del =0
) as a   order by ctime desc limit 10,20

你可能感兴趣的:(sql,开发语言)