Search Postgresql Archives

request help forming query

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

 



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!





---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[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