thinkphp5 chain operation join usage

Join usually has the following types, and different types of join operations will affect the returned data results.

INNER JOIN: equivalent to JOIN (the default JOIN type), if there is at least one match in the table, the row is returned.
LEFT JOIN: even if there is no match in the right table, all rows are returned from the left table.
RIGHT JOIN: even if there is no match in the left table Match, also return all rows from the right table
FULL JOIN: As long as there is a match in one of the tables, return the row
www.tk-acc.com
model object

For example

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();

Guess you like

Origin blog.51cto.com/13959155/2541446