Re: SQL question: checking all required items - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: SQL question: checking all required items
Date
Msg-id 46BDFA3B.8000307@iol.ie
Whole thread Raw
In response to SQL question: checking all required items  (Raymond O'Donnell <rod@iol.ie>)
List pgsql-general
On 10/08/2007 22:03, Carlos Ortíz wrote:

> Select * from people where person_id in (
>       Select person_ID from Items_for_people group by Person_id Having Count(*) = (
>            Select count(*) from Items Where is_required = true))

That seems to work fine! I'd only change "having count(*) = ..." to
"having count(*) >= ..." to allow for people having other items in
addition to the required ones.

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

pgsql-general by date:

Previous
From: Hannes Dorbath
Date:
Subject: Re: Installing Postgresql 8.2 on Windows Vista
Next
From: Hannes Dorbath
Date:
Subject: Re: virtual database