ThinkPHP中关联查询(即多表联合查询)可以使用 table() 方法或和join方法,具体使用如下例所示:
1、原生查询示例:
firstRow.','.$p->listRows;
$voList = $Model->query($sql);
2、join()方法示例:
join('RIGHT JOIN user_profile ON user_stats.id = user_profile.typeid' );
3、table()方法示例:
table('user_status stats,user_profile profile')->where('stats.id = profile.typeid')->field('stats.id as id,stats.display as display,profile.title as title,profile.content as content')->order('stats.id desc' )->select();
更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《》、《》、《》、《》及《》。
希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。