SQL: Check if entry exists and return if it DOESN'T : I want to check if an entry exists in one table based on a value from a 2nd table, but if it DOESN'T exist then select the value from the 2nd table.

To explain, I have a table called `devices` and a table called `tests`. Each device in `devices` has a unique identifier (an integer). Each test in `tests` references the a device that the test was run on. Therefore, every `test` is associated with a `device`. However, not every `device` has been tested. Moreover, multiple tests could have been run on a single device.

So what I want to `SELECT` is all entries in `devices` that are NOT referenced by at least one entry in `tests`.