DEDECMS织梦dede:sql语句自定义模型多表联合查询 同时调用多个字段 时间:2019-06-12 00:00 来源: 点击:次 dede中从两张表中查询会员并调用两张表甚至多张表中的字段,比如,年龄,生日,等等。 举个栗子: 主表:wl_archives 副表:wl_addon18,wl_addon17; {dede:sql sql="select wl_archives.*,wl_archives.litpic, wl_archives.title,wl_addon18.style,wl_addon18.jushi,wl_addon18.diqu,wl_addon18.mianji,wl_addon18.diqu from (wl_addon18 left join wl_archives on wl_addon18.aid = wl_archives.id) left join wl_addon17 on wl_addon17.name = ~name~ where wl_addon18.name=~name~"} <div class="item"> <a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]" rel="nofollow"> <div class="pic pr lazy"> <img src="[field:litpic/]" alt="[field:title/]" class="lazy_img auto"> <span class="picNum pa"><i class="icon icon-tupian"></i> <span class="num">0</span></span> </div> <div class="info pr"> <p class="name"><h2>[field:title/]</h2></p> <p class="tag"><a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:jushi/]</a>| <a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:style/] </a>|<a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:mianji/]平</a></p> <p class="zan pa " id="134067"><i class="icon icon-zan"></i> <span class="num">0</span></p> </div> </a> </div> {/dede:sql} (责任编辑:admin)