Re: [GENERAL] request help forming query

2008-02-25 Thread danmcb
yes, this could get called on quite large tables (maybe not billions ...). The second solution looks useful - I'll try it on some test data. thanks both of you. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] request help forming query

2008-02-24 Thread Vyacheslav Kalinin
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 extens

Re: [GENERAL] request help forming query

2008-02-24 Thread brian
danmcb wrote: 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 descrip

[GENERAL] request help forming query

2008-02-24 Thread danmcb
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 Table