joinRight()

joinRight($tableName, $fieldLeft = null, $fieldRight = null, $tableRight = null, $operator = '=')

Equivalent to $this->join() but instead automaticaly puts a RIGHT JOIN into the JOIN string for more information see join()
@param String $tableName
@param String $fieldLeft
@param String $fieldRight
@param String $tableRight
@param String $operator
@return PhpBURN_Core

Params


$tableName
Name of the table that will receive the JOIN

$fieldLeft
The field form left side of the join ON statement

$fieldRight
Value or field on the right side of ON statement

$tableRight (optional)
When you want to use $fieldRight as a table field you should specify this param with the right table to be attached to $fieldRight field

$operator (optional)
The operator for ON statment

Explanation


Many times just simple selects aren’t enough for us to do our work, so join is a real friend but many developers don’t know or are afraid of use JOIN, so now your problems are solved.

Let’s see usage examples of this method:

$user = new Users();

$user->joinRight('albums','user','id_user','=',$user->_tablename);

$user->find();

That will generate a SELECT with something like that “RIGHT JOIN albums ON albums.user = users.id_user”

or you can use it even more SIMPLE

$user = new Users();

$user->joinRight('albums','date',date('Y-m-d')); 

$user->find();

That will generate a SELECT with something like that “RIGHT JOIN albums ON albums.date = ‘2010-06-27′” in my case

Once more… BE CREATIVE