Welcome Guest, Not a member yet? Register   Sign In
Join query problem
#5

[eluser]andriu[/eluser]
Thanks for the replies

Noctrum your correct that I get the data from all three tables.

What i want to do something similar to this i believe:

Code:
$this->db->from('incidencias');


$this->db->join('clients', 'incidents_client_id = client_id', 'LEFT');

or

$this->db->join('elevators', 'incidents_elevator_id = elevator_id', 'LEFT');
$this->db->join('clients', 'incidents_client_id = elevators.client_id', 'LEFT');

Which (in my mind =)) would get me the:
elevator and the client if the incident is related to a elevator.

and just the client if the incident is related to a client

But Im not sure how to join the client table again but the second time with the elevator table...

forgot to make this clear

I only have either the elevator id or the client id in the incident table not both at the same time as i would no want to select the wrong client if the owner of the elevator changes


Messages In This Thread
Join query problem - by El Forum - 02-25-2010, 07:59 AM
Join query problem - by El Forum - 02-25-2010, 08:38 AM
Join query problem - by El Forum - 02-25-2010, 08:48 AM
Join query problem - by El Forum - 02-25-2010, 08:49 AM
Join query problem - by El Forum - 02-25-2010, 09:04 AM
Join query problem - by El Forum - 02-25-2010, 09:30 AM
Join query problem - by El Forum - 02-25-2010, 10:00 AM
Join query problem - by El Forum - 02-25-2010, 10:05 AM
Join query problem - by El Forum - 03-03-2010, 06:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB