菜鸟国际电子游戏首页 > 文章中心 > 正文

thinkphp 3.x 连贯操作-电子游戏app下载



alias 和 join(left)

$model = m('user');
$model->alias('a')->field('a.*,b.age')->join('user_info as b on a.id = b.u_id')->select();
sql如下:
select a.*,b.age from user a left join user_info as b on a.id = b.u_id
right join
$model->alias('a')->field('a.*,b.age')->join('right join user_info as b on a.id = b.u_id')->select(); sql如下: select a.*,b.age from user a right join user_info as b on a.id = b.u_id


sum:

#统计符合条件的文章阅读量m('article')->where($map)->sum('click');



转载请注明出处:

0

相关文章