phpcms listinfo 怎么实现联表查询
展开全部
1 自定义字段如果不是在主表中,如册神果要查询州隐亏该字段,就要用到moreinfo="1" 实现该模型主表和附表关联查询.
例如:
{pc:content action="lists" catid="$catid" moreinfo="1" order="listorder DESC" num="10" }
{loop $data $val}
{$val['zidingyiziduan']}
如果没有moreinfo="1"就查询不到携稿 {$val['zidingyiziduan']}
2 另外就只能写sql关联查询了!
{pc:get sql="select a.`url`,a.`catid`,a.`title`,a.`description` from v9_news as a left join v9_position_data as b on a.id = b.id and a.catid=b.catid where a.catid= 6 and a.status =99 and b.posid = 11 group by a.id order by a.id desc" num="10" start="0"}
{loop $data $r}
例如:
{pc:content action="lists" catid="$catid" moreinfo="1" order="listorder DESC" num="10" }
{loop $data $val}
{$val['zidingyiziduan']}
如果没有moreinfo="1"就查询不到携稿 {$val['zidingyiziduan']}
2 另外就只能写sql关联查询了!
{pc:get sql="select a.`url`,a.`catid`,a.`title`,a.`description` from v9_news as a left join v9_position_data as b on a.id = b.id and a.catid=b.catid where a.catid= 6 and a.status =99 and b.posid = 11 group by a.id order by a.id desc" num="10" start="0"}
{loop $data $r}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询