Reputation: 1834
In my system there are projects and feedbacks(project's feedbacks) and i have two related tables:
PROJECTS(id, project_title, project_description, ...)
FEEDBACKS(id, project_id, to_id, from_id, ...)
I use left join but i want to get projects which are doesn't have a feedback. How can i done this ?
Thank You
Upvotes: 0
Views: 32
Reputation: 12843
This one works on all major databases.
select *
from projects p
where not exists(
select *
from feedbacks f
where p.id = f.project_id);
Upvotes: 2
Reputation: 86406
Select * from
projects p right join feedbacks f on p.id=f.project_id
where p.id is null
group by f.project_id
Upvotes: 1