1. 程式人生 > >tp5資料庫的多表互聯查詢

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來表示條件