您好,登錄后才能下訂單哦!
語法
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();
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。