Re: querying from 3 tables

From: ryanne cruz <ryanne(dot)cruz(at)up(dot)edu(dot)ph>
To: "\\\"pgsql-php(at)postgresql(dot)org\\\"" <pgsql-php(at)postgresql(dot)org>
Subject: Re: querying from 3 tables
Date: 2003-03-07 05:11:04
Message-ID: 1047013864.3e6829e837bdb@mail.up.edu.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


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?

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-03-07 05:30:49 Re: querying from 3 tables
Previous Message Travel Jadoo 2003-03-01 11:12:36 pg_connect