Re: SQL question: checking all required items
| От | Scott Marlowe |
|---|---|
| Тема | Re: SQL question: checking all required items |
| Дата | |
| Msg-id | dcc563d10708101329l2b38c6d1w364acc08d3a32e11@mail.gmail.com обсуждение исходный текст |
| Ответ на | SQL question: checking all required items (Raymond O'Donnell <rod@iol.ie>) |
| Ответы |
Re: SQL question: checking all required items
|
| Список | pgsql-general |
On 8/10/07, Raymond O'Donnell <rod@iol.ie> 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);
В списке pgsql-general по дате отправления: