自定义列表多表查询统计

统计记录:

select count(*) as total from [!db.pre!]ecms_news union select count(*) as total from [!db.pre!]ecms_movie

查询记录:

select classid,id,titleurl,title,newstime from [!db.pre!]ecms_news union select classid,id,titleurl,title,newstime from [!db.pre!]ecms_movie order by newstime desc

———————–注释:——————————-

以上调用的是(新闻模型:news、电影模型:movie)两个模型的文章,两个模型用“Union”连接调用

若指定栏目用:where classid in(46,47,51),

若调用推荐在其后追加:and isgood=1,

若指定调用条数在其后追加:limit 10

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。