jeudi 14 juillet 2016

SQL - find records where id doesn't exist in / have ANY

SQL - find records where a owner dont have ANY rental car. I've got the following (in MS Access):

Car_Owner
+----+------+---------+--------+
| id | name | Car reg | Rental |
+----+------+---------+--------+
| 1  | Adam | ABC123  |  True  | 
+----+------+---------+--------+
| 2  | John | XXX111  |  True  | 
+----+------+---------+--------+
| 2  | John | XXX222  |  False | //Same person as above
+----+------+---------+--------+
| 3  | Eva  | YYY999  |  False | 
+----+------+---------+--------+

How do I find out who dosn't rent ANY car? In this case would be just Eva. John should not be listed since he already got a rental car.

Any help would be much appreciated.

Aucun commentaire:

Enregistrer un commentaire