This tutorial will show you how we can use Codeigniter’s Query Builder Class to build join queries for fetching data from multiple tables.
The purpose of a join is to combine the data across tables.
A join is actually performed by the where clause which combines the specified rows of tables.
If a join involves in more than two tables then first two tables are joined based on the join condition and then compares the result with the next table and so on.
Here we will see Full Outer Join example. Outer join gives the non-matching records along with matching records. Full Outer Join will display the all records from both tables.
MySQL does not support Full Outer Join but we will simulate full outer join using Union query. Codeigniter’s Active Record does not support Union query so we will use db->query() to get results from MySQL.