I have two tables, one being Bookings and the other being Customers.
A booking is linked to the customer table with a Customer_ID field which is NULL by Default, and updated when a customer is assigned.
I am trying to run an SQL Query in codeigniter which pulls back all the bookings, and is joined with the customer table by Customer_ID, however the statement does not seem to work as nothing is pulled back when the join is added.
Here the statement
$this->db->select('*');
$this->db->from('Bookings');
$this->db->join('Customers', 'Customers.ID = Bookings.Customer_ID');
$query = $this->db->get();
return $query->result();
I guess the problem must be related to the fact that many bookings don't have a customer ID to join, but I guessed it would only do it to bookings that did.
Does anyone know the correct way to this?
Help















