X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BF91ED8A5B for ; Fri, 2 Sep 2005 18:25:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74299-07 for ; Fri, 2 Sep 2005 21:25:56 +0000 (GMT) Received: from hotmail.com (bay101-dav16.bay101.hotmail.com [64.4.56.88]) by svr1.postgresql.org (Postfix) with ESMTP id F2463D89A9 for ; Fri, 2 Sep 2005 18:25:55 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 2 Sep 2005 14:25:57 -0700 Message-ID: Received: from 64.4.56.200 by BAY101-DAV16.phx.gbl with DAV; Fri, 02 Sep 2005 21:25:57 +0000 X-Originating-IP: [64.4.56.200] X-Originating-Email: [x_download@hotmail.com] X-Sender: x_download@hotmail.com From: "Oz" To: Subject: Searching for results with an unknown amount of data Date: Fri, 2 Sep 2005 22:27:07 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcWwBRIFqztSaK00SEGNRuWP2z2g6A== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-OriginalArrivalTime: 02 Sep 2005 21:25:57.0821 (UTC) FILETIME=[E892A6D0:01C5B004] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.666 required=5 tests=[AWL=-0.916, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, MSGID_FROM_MTA_HEADER=0, RCVD_IN_BL_SPAMCOP_NET=1.832] X-Spam-Level: ** X-Archive-Number: 200509/21 X-Sequence-Number: 22568 Hi, I've got two tables, A and B, the first one containing columns A_ID | info where A_ID is primary, so that this table stores various information about an object, and the second containing columns A_ID | property where property is an integer referring to a particular property that an object may possess. I've seperated these into two tables so that an object may have several (ie an unknown number of) properties. Now, I want to find all objects that have at most properties 1,2,3, say (so something with (1,2) is okay, as is (1,2,3)). I can't see a way to do this -- can anyone help? Also, what if I want to find all the objects possessing properties 4,5,6, as well as possibly other things? I've done it with nested SELECTs (constructed programmatically), but I think this is quite slow and not a very pleasing solution. Obviously, both these things will need to be done for an arbitrary list of integers. Thanks, DL