多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ Db::query("select a.cate_id,a.cate_name,a.icons,count(b.cate_id) AS company_count from sbzh_category AS a LEFT JOIN sbzh_company AS b ON a.cate_id=b.cate_id group by a.cate_id"); ~~~ ~~~ 参数绑定情况 Db::query("select * from think_user where id=? AND status=?", [8, 1]); ~~~ ~~~ 第二种方法 $data=Db::table('sbzh_category')->alias('a')->leftJoin('sbzh_company b','a.cate_id=b.cate_id')->field('a.cate_id,a.cate_name,count(b.cate_id) as company_count')->group('a.cate_id')->select(); ~~~