**Problem:**

I'm trying to figure out how to join tables based on a condition in an SQL statement. I've spent an hour searching Google, SO, various websites and the MYSQL manual, but I just can't find the correct syntax for what I want to do.

I can't post the exact query I'm trying to get working, but I will post a simplified version for simplicity reasons.

**Scenario:**

Assuming I have three tables, `a` = person table, `b` = address table and `c` = car table.

Table `b` will always be joined to table `a`, becuase a person always lives at an address, but table `c` should only be joined to `a` if the value in the 'car\_id' field is more than 0, because having a car is optional.

**The query:**

```
SELECT a.firstname, a.lastname, a.gender, a.address_id, b.address_firstline,  b_address_secondline, b.postcode, c.car_manufacturer, c.car_model 
FROM a 
INNER JOIN b ON b.id = a.address_id 
INNER JOIN c ON c.id = a.car_id AND a.car_id > 0 
WHERE a.id = 1

```

The query above will run fine for a person with the id of 1 because he owns a car. However, if the query is run for a person with the id of 2, the query will return 0 rows because she does not own a car. 

How do I make this second JOIN optional? I've tried using the IF ELSE statement, but I'm forever getting syntax errors. Could someone point me in the right direction here? Thanks in advance