语法join ( mixed join [, mixed $condition = null [, string $type = 'INNER']] )
示例
别名Db::table('think_artist')
->alias('a')
->join('think_work w','a.id = w.artist_id')
->join('think_card c','a.card_id = c.id')
->select();Db::table('think_artist')
->alias('a')
->join('__WORK__ w','a.id = w.artist_id')
->join('__CARD__ c','a.card_id = c.id')
->select();$join = [
['think_work w','a.id=w.artist_id'],
['think_card c','a.card_id=c.id'],
];Db::table('think_user')->alias('a')->join($join)->select();
全称Db::table('think_user')->join('__WORK__','__ARTIST__.id = __WORK__.artist_id')->select();
right方式Db::table('think_user')->alias('a')->join('word w','a.id = w.artist_id','RIGHT')->select();
表名是子查询$subsql = Db::table('think_work')
->where(['status'=>1])
->field('artist_id,count(id) count')
->group('artist_id')
->buildSql();
Db::table('think_user')
->alias('a')
->join([$subsql=> 'w'], 'a.artist_id = w.artist_id')
->select();