On 8/10/07, Raymond O'Donnell <[EMAIL PROTECTED]> wrote:
> - how can I find those people who don't have _all_ of the items which
> are marked "required"?
>
> In other words, how do I select those rows in "people" which don't have
> a corresponding row in "items_for_people" for *each* row in "items"
> which has is_required=true?

Without writing the exact query you need, I'll give you a couple of
ways to solve the problem of finding things in one set that aren't in
another.

select table1.id from table1 left join table2 on (table1.id=table2.id)
where table2.id is null
OR
select table1.id from table1 where table1.id is not in (select id from table2);

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to