Search Postgresql Archives

Re: SQL question: checking all required items

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx
---------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux