join() public method

Examples: $q->join('address'); // on user.address_id=address.id $q->join('address.user_id'); // on address.user_id=user.id $q->join('address a'); // With alias $q->join(array('a'=>'address')); // Also alias Second argument may specify the field of the master table $q->join('address', 'billing_id'); $q->join('address.code', 'code'); $q->join('address.code', 'user.code'); Third argument may specify which kind of join to use. $q->join('address', null, 'left'); $q->join('address.code', 'user.code', 'inner'); Using array syntax you can join multiple tables too $q->join(array('a'=>'address', 'p'=>'portfolio')); You can use expression for more complex joins $q->join('address', $q->orExpr() ->where('user.billing_id=address.id') ->where('user.technical_id=address.id') )
public join ( string $foreign_table, mixed $master_field = null, string $join_kind = null, string $_foreign_alias = null )
$foreign_table string Table to join with
$master_field mixed Field in master table
$join_kind string 'left' or 'inner', etc
$_foreign_alias string Internal, don't use
示例#1
0
 function join($table, $on, $type = 'inner')
 {
     return parent::join($this->prefix . $table, $alias);
 }
示例#2
0
文件: prefixed.php 项目: atk4/atk4
 public function join($table, $on, $type = 'inner', $alias = UNDEFINED)
 {
     return parent::join($this->prefix . $table, $alias);
 }