tp5数据库的多表互联查询

$this 是model模板类
 
 

$result = $this ->alias('a') ->join('px_sucai_question_from b','a.e_from = b.id') ->join('px_sucai_question_detail c','a.id = c.head_id') ->field($field) ->where($where) ->limit($start,$length) // ->order('a.begin_time desc') ->select();

这样可能也会出问题。

可以尝试修改join里面的内容为: join('px_sucai_question_from b on a.e_from =b.id');      即是用on来表示条件

猜你喜欢

转载自blog.csdn.net/qq_21208843/article/details/80745943