This database is a very basic concept for a *video rental store*. The database is displayed with the use of PHP (and HTML, CSS, bootstrap, etc).

I have **three** tables:

**tl\_dvd**: which holds the basic info about the dvd, duration date, name, language, etc.

[![tl_dvd](https://i.stack.imgur.com/M52jN.png)](https://i.stack.imgur.com/M52jN.png)

**tl\_order**: which holds the name of the person who rented a movie and the startdate.

[![tl_order](https://i.stack.imgur.com/e8u7X.png)](https://i.stack.imgur.com/e8u7X.png)

**tl\_client**: which isn't really relevant to my question/problem, but just holds the first and last name of the clients.

When I'm on the order page it displays all the orders which are currently running. I have one column called `returned` in `tl_order` with a tinyint where `0` **stands for not returned** and `1` **stands for returned**. 

There's a button which says '*terug gebracht*' (='received back' in English) which will set the selected order to 1. **The tl\_order only displays the orders which are not returned yet (`returned` set on 0).** On the end of the SQL query I've set something like `... AND returned = 0';`

**Here is the part where I'm supposed to use the `LEFT (OUTER?) JOIN`.** If an order is not back (so that means `returned` is still on `0` in `tl_order`) the dvd should not show up in my `tl_dvd` (think of it like we only have one dvd copy for every movie). I've tried these `LEFT JOIN`s in `tl_dvd`:

```
'SELECT * FROM tl_dvd LEFT JOIN tl_order WHERE tl_order.returned = 1';

```

Breaks my page with 500 error.

```
'SELECT * FROM tl_dvd LEFT JOIN tl_order ON tl_order.returned = 1';

```

Doesn't give me an error but spams every title like 3 times.

Can someone explain me how to tackle this issue or what I'm doing wrong?