帝国CMS如何实现联合查询多表信息调用

 帝国CMS如何实现多表信息调用


推荐调用:
[e:loop={'select title,titleurl,titlepic from [!db.pre!]ecms_photoz where classid in(46,47,51) and isgood=1 Union All select title,titleurl,titlepic from [!db.pre!]ecms_downloadz',0,24,0}]
这里是模板样式
[/e:loop]

最新调用:
[e:loop={'select title,titleurl,titlepic from [!db.pre!]ecms_photoz where classid in(46,47,51) Union All select title,titleurl,titlepic from [!db.pre!]ecms_downloadz ',0,24,0}]
这里是模板样式
[/e:loop]

以上两例是调用图片和下载模型中的。。

[!db.pre!]ecms_photoz 图片数据表(注:系统默认是[!db.pre!]ecms_photo)

[!db.pre!]ecms_downloadz下载数据表(注:系统默认是[!db.pre!]ecms_download)

参数
classid in(46,47,51)      这里是调用的栏目多个用,分开

and isgood=1              条件

其他参数和灵动标签一样

最新5条记录

[e:loop={'select  title,titleurl,jiage  from [!db.pre!]ecms_a where classid in(7) and jiage>=100 and jiage<=2000 Union All select title,titleurl,jiage  from [!db.pre!]ecms_b where classid in(19) and jiage>=100 and jiage<=2000 limit 5',0,24,0}]
<li><a href="<?=$bqsr[titleurl]?>"><?=$bqr[title]?>--<?=$bqr[jiage]?></a></li>
[/e:loop]

扫一扫手机访问