MiniGunnR MiniGunnR - 1 year ago 55
SQL Question

How do I do an SQL query based on a 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 do I find all the people whose parent's name is not Carol?

Answer Source

You can try below code

select from people
inner join parent on
where not in ('Carol')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download