Re: request help forming query

From: "Vyacheslav Kalinin" <vka(at)mgcp(dot)com>
To: brian <brian(at)zijn-digital(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: request help forming query
Date: 2008-02-25 05:55:45
Message-ID: 9b1af80e0802242155s270f63c6mca4daf01574e5454@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-02-25 06:14:25 Re: Planner: rows=1 after "similar to" where condition.
Previous Message brian 2008-02-25 05:13:41 Re: request help forming query