Alessandro95 Alessandro95 - 1 year ago 73
MySQL Question

MySql. DB owner and car

I have 2 tables in my DB:

I have to extract the owners that haven't a car and live in IT, we are talking about "Arthur".

SELECT * FROM owner, car WHERE city = 'IT' and owner.idOwner != car.idOwnerFK

city is working but not like the second part.
How can i solve my problem? Thanks

Answer Source


SELECT  * FROM owner WHERE city = 'IT' and idOwner not in (select  idOwnerFK from car)