Re: querying from 3 tables

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: querying from 3 tables
Дата
Msg-id 02c901c2e46a$b6841150$6500a8c0@fhp.internal
обсуждение исходный текст
Ответ на Re: querying from 3 tables  (ryanne cruz <ryanne.cruz@up.edu.ph>)
Список pgsql-php
> 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?

You can do this:

select geom from table3 where munprovid=(select munprovid from table2 where
brgyid=(select brgyid, households from table1 where esourceid=$esourceid));

Chris


В списке pgsql-php по дате отправления:

Предыдущее
От: ryanne cruz
Дата:
Сообщение: Re: querying from 3 tables
Следующее
От: Francesco Piccinini
Дата:
Сообщение: Re: querying from 3 tables