CodeIgniter join query example – onlinecode

CodeIgniter join query example – onlinecode

In this post we will give you information about CodeIgniter join query example – onlinecode. Hear we will give you detail about CodeIgniter join query example – onlinecodeAnd how to use it also give you demo for it if it is necessary.

In this exam, we will discuss about how to use Join query in the CodeIgniter framework. what Join Query? if you need two or more tables data then we can easily get data using the Join query.

join query is the specific type available like left join, right join, outer join, inner join, left outer join, and right outer join.

See also  Picture-in-Picture with JavaScript and Angular 10

Join query in codeigniter

The join query method is used to fetch data into two or more tables.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id')
->get();

Left join query in codeigniter

The left join query method is used to return all rows data into the left table and return the equal rows of data into the right table.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','left')
->get();

Right join query in codeigniter

The right join query method is used to return all rows data into the right table and return the equal rows data into the left table.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','right')
->get();

Inner join query in codeigniter

The Inner join query method is used to return matching rows data into both tables.

See also  Ionic 5 - Geolocation Plugin, Google Maps and Places API

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','inner')
->get();

Outer join query in codeigniter

The Outer join query method is used to return all rows data into both tables.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','outer')
->get();

Left outer join query in codeigniter

The left outer join query method is used to return all rows data into the left table and return the equal rows of data into the right table.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','left outer')
->get();

Right outer join query in codeigniter

The right outer join query method is used to return all rows data into the right table and return the equal rows of data into the left table.

$this->db->select('*')
->from('product')
->join('category','category.id = product.category_id','right outer')
->get();

Please follow and like us:

Hope this code and post will helped you for implement CodeIgniter join query example – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

See also  check whether a variable is set or not in PHP

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

8  +  2  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US