request help forming query

From: danmcb <danielmcbrearty(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: request help forming query
Date: 2008-02-25 04:37:57
Message-ID: 9704943c-523f-46cf-b739-aa9c106e1541@n58g2000hsf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

!'ve been wondering how to formulate a query to get a set of objects
out of a database, and am a bit stuck. I hope that someone here might
be able to help.

This is what the db looks like:

Table TYPES
id int primary key,
description text

Table GROUPS
id int primary key
description text

Tables WIDGETS
type_id int references TYPES(id),
group_id int references GROUPS(id),
primary key(type_id, group_id)

Now, given two type_id's, say A and B, I would like to find all groups
(or group_id's of course) that have a widget of both of these two
types.

Can anyone help with this please? Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message brian 2008-02-25 05:13:41 Re: request help forming query
Previous Message Adam Rich 2008-02-25 03:31:53 Re: no-arg cluster and locks ...