| From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
|---|---|
| To: | Carlos Ortíz <carlos(dot)ortiz(at)stps(dot)gob(dot)mx> |
| Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: SQL question: checking all required items |
| Date: | 2007-08-11 18:04:43 |
| Message-ID: | 46BDFA3B.8000307@iol.ie |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)iol(dot)ie
---------------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannes Dorbath | 2007-08-11 18:05:49 | Re: virtual database |
| Previous Message | Hannes Dorbath | 2007-08-11 17:53:23 | Re: Installing Postgresql 8.2 on Windows Vista |