thinkPHP多表联合查询
2014-09-04 09:33
225 查看
1、原生查询示例:
2、join()方法示例:
3、table()方法示例:
1 | $Model = new Model(); |
2 | $sql = 'select a.id,a.title,b.content from think_test1 as a, think_test2 as b where a.id=b.id ' . $map . ' order by a.id ' . $sort . ' limit ' . $p ->firstRow. ',' . $p ->listRows; |
3 | $voList = $Model ->query( $sql ); |
1 | $user = new Model( 'user' ); |
2 | $list = $user ->join( 'RIGHT JOIN user_profile ON user_stats.id =user_profile.typeid' ); |
1 | $list = $user ->table( 'user_status stats, user_profile profile' )->where( 'stats.id )->field( 'stats.id as id, stats.display as display, profile.title as title,profile.content as content' )->order( 'stats.id desc' )->select(); |
相关文章推荐
- ThinkPHP多表联合查询的常用方法
- ThinkPHP多表联合查询的常用方法
- ThinkPHP多表联合查询的常用方法
- thinkPHP多表联合查询
- thinkphp 使用原生mysql语句 联合查询
- PHP开发之THINKPHP多表联合查询操作的三中方法
- thinkphp 数据库设置前缀问题 联合查询
- ThinkPHP多表联合查询实例代码
- Thinkphp5 联合(关联)查询
- PHP开发之THINKPHP多表联合查询操作的三中方法
- ThinkPHP多表联合查询的常用方法
- thinkphp多表联合查询
- ThinkPHP5联合(关联)查询、多条件查询与聚合查询实例详解
- ThinkPHP多表联合查询的常用方法
- thinkphp3.1 多表联合查询代码
- Thinkphp联合查询
- ThinkPHP多表联合查询的常用方法
- PHP开发之THINKPHP多表联合查询操作的三中方法
- thinkphp5.0中两表联合查询
- thinkphp3.2使用join联合查询