You'll need to do a join limiting the data by you geographic constraints like:<br><br>select counties.*, <a href="http://states.name">states.name</a> from counties,states where within(counties.the_geom,states.the_geom)<br>
<br><div><span class="gmail_quote">On 9/21/06, <b class="gmail_sendername">Steve Benzo</b> <<a href="mailto:steve_benzo@yahoo.com">steve_benzo@yahoo.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>In a particular Postgis/postgres database, I have<br>several  geographic tables, countya, countyb, etc. I<br>would like to have a way to feed the within or contain<br>function a state's extent to find out which counties
<br>are within a particular state. I've tried a few<br>iterations of queries without any luck, and so I was<br>hoping someone could point me in the right direction,<br>as far as the base SQL postgis statement to allow me<br>
to accomplish this.<br><br>So far, I was thinking I could loop through the each<br>of the tables, use the within command with the state's<br>extent and the county's extent, and see if it returns<br>true. The problem I'm having is, like I mentioned,
<br>getting this SQL statement together.<br><br>Many thanks<br><br>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam?  Yahoo! Mail has the best spam protection around<br><a href="http://mail.yahoo.com">
http://mail.yahoo.com</a><br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">
http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>************************************<br>David William Bitner