Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

Left Join Query in Codeigniter

by
Category:codeigniter
codeigniter mysql
Left Join Query in Codeigniter

The LEFT JOIN is sometimes called as LEFT OUTER JOIN and is performed on two database tables - the first table (on the left side) is referred as LEFT TABLE and and the second (on the right side) one as RIGHT TABLE. The LEFT JOIN returns all the rows from the LEFT TABLE along with the matching rows on the RIGHT TABLE.

Let’s create a left join method in codeigniter

$this->db->select('tbl_order.*,tbl_user.fullname');
$this->db->from('tbl_order');
$this->db->join('tbl_user', 'tbl_user.id = tbl_order.user_id','left');
$query = $this->db->get();
return $query->result();

0 Comments


Html code work in comment box


Related Post