Join Method

Join method is part of database for joining table.

Parameters

Update method has 6 required parameters.

$this->db->join(
            string $table2,
            string $table2_alias,
            string $table2_column_to_joined,
            string $table1_alias,
            string $table1_column_to_joined,
            string $join_method
          ): dbObject

$table_name

Table Name refer to table name.

$alias

Alias Aliased name of $table_name.

Example usage

Here is the examples using select method. See the first of this page for full example.

Basic Usage

For example we assumed want to add new data in blog table. First, in the model:

class Blog_Model extends SENE_Model{
  var $tbl = 'blog';
  var $tbl_as = 'b';
  var $tbl2 = 'user';
  var $tbl2_as = 'u';

  public function __construct(){
	 parent::__construct();
  }
  public function getAll(){
    $this->db->select_as("$this->tbl_as.*, $this->tbl2_as.name","author",0);
    $this->db->from($this->tbl,$this->tbl_as);
    $this->db->join($this->tbl2,$this->tbl2_as,"user_id",$this->tbl_as,"id","");
    return $this->db->get();
  }
}