Alessandro95 Alessandro95 - 1 year ago 107
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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download