$sql = Db::connect(‘数据库‘)->table(‘B表‘)->where(‘status‘, ‘normal‘)->field(‘字段 别称【不可与其他表重复】‘)->buildSql(); $total = $this->model ->fetchSql(false) ->with([‘C表‘]) ->join([$sql=>‘B表‘],‘B表关联C表字段 = C表关联B表字段‘,‘left‘) ->where($where) ->order($sort, $order) ->count();
fastadmin中关联表时A为主表,想让B表和C表关联时怎么办?
原文:https://www.cnblogs.com/zsczsc/p/11498682.html