MiniGunnR MiniGunnR - 5 months ago 23
SQL Question

How to do SQL query based on foreign key field?

I have the following tables:


id, name


id, people_id, name

I have tried the following:

SELECT * FROM people
LEFT JOIN parent ON = parent.people_id
WHERE != 'Carol';

How to find all the people whose parent's name is not Carol?


You can try below code

select from people
inner join parent on
where not in ('Carol')