Search Postgresql Archives

Re: request help forming query

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

 



Given that (type_id, group_id) is the PK of widgets it is possible to
avoid self-join:

select group_id from widgets
 where type_id = A or type_id = B
 group by group_id
having count(1) = 2;

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[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