thinkphp left join

作者:夏雨芭蕉时间:2016-05-10 13:40:15 浏览量:

        $db = D('database');

        $joinStr=" as a LEFT JOIN  yanzhi_database_data as b on a.id=b.id ";

        $res=$db->field("description")->join($joinStr)->where(" a.id=4 ")->find();

          $db->getlastsql();

    SELECT description FROM `yanzhi_database` as a LEFT JOIN yanzhi_database_data as b on a.id=b.id where a.id=4 


Copyright © 2016 Allister All Rights Reserved