# Table Joining
xCRUD provide table joining and manipulating with a few tables in one box. You can use extended field syntax, when you type field name (column name or alias) as table and field with dot separator (sample: $xcrud->change_type('order.total', 'price')😉. You no need to use this when you not use table joining.
# join()
field, joined_table, join_on_field [, alias] [, not_insert] )
Parameters:
fields -
field - field from current table to join; joined_table - table, that is joined; join_on_field - joining on this column from joined table; alias - (optional) - need to use when you join one tabes more than one times.
not_insert - allows to disable inserting and deleting rows from joined table.
$xcrud->table('users');
// join users and profiles on users.id = profiles.user_id
$xcrud->join('id','profiles','user_id');
// now join 'profiles' and 'tokens' tables
$xcrud->join('profiles.token_id','tokens','id'); // on profile.token_id = tokens.id
// simple actions with fields: default and joined
$xcrud->column('username','email','profile.city','tokens.created');
join uses INNER JOIN, thats mean in all tables must be present joined rows. join connects only one row from table, joined on fields must be unique. When joined rows in not unique xCRUD will be worked incorrect.