X-Original-To: pgsql-php@postgresql.org Received: from mail02.up.edu.ph (unknown [210.14.43.1]) by postgresql.org (Postfix) with SMTP id B967D47630C for ; Thu, 6 Mar 2003 23:54:57 -0500 (EST) Received: (qmail 13575 invoked by uid 504); 7 Mar 2003 05:34:02 -0000 Received: from ryanne.cruz@up.edu.ph by web2 with qmail-scanner-1.01 (update: v4251 05 Mar 2003. Clean. Processed in 0.756566 secs); 07 Mar 2003 05:34:02 -0000 Received: from unknown (HELO b01.mail.up.edu.ph) (10.16.3.1) by 10.16.3.144 with SMTP; 7 Mar 2003 05:34:01 -0000 Received: (qmail 16663 invoked by uid 504); 7 Mar 2003 05:00:38 -0000 Received: from ryanne.cruz@up.edu.ph by b01 with qmail-scanner-1.01 (update: v4251 05 Mar 2003. Clean. Processed in 0.451317 secs); 07 Mar 2003 05:00:38 -0000 Received: from unknown (HELO localhost) ([10.16.3.5]) (envelope-sender ) by 10.16.3.1 (qmail-ldap-1.03) with SMTP for ; 7 Mar 2003 05:00:37 -0000 Received: from 10.33.187.90 ( [10.33.187.90]) as user rocruz1@b04.mail.up.edu.ph by mail.up.edu.ph with HTTP; Fri, 7 Mar 2003 13:11:04 +0800 Message-ID: <1047013864.3e6829e837bdb@mail.up.edu.ph> Date: Fri, 7 Mar 2003 13:11:04 +0800 From: ryanne cruz To: "\\\"pgsql-php@postgresql.org\\\"" Subject: Re: querying from 3 tables MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1 X-Originating-IP: 10.33.187.90 X-Archive-Number: 200303/3 X-Sequence-Number: 1915 hi list. i have 3 tables with the following columns: table1: esourceid (primary key), brgyid, households table2: brgyid (primary key), munprovid table3: munprovid (primary key), geom i am given the esourceid and i need to query the brgyid and the households of a particular esourceid: query1="select brgyid, households from table1 where esourceid=$esourceid;" the resulting brgyid will then be used to query for the munprovid in table2: query2="select munprovid from table2 where brgyid=(query1);" the resulting munprovid will then be used to query for the geom column: "select geom from table3 where munprovid=(query2);" my question is, how do i do this? any ideas?