<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV>Ok, ok, after some more searching I found something. With some tweaking and tuning I got something like this:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN><B>DATA 'the_geom FROM (SELECT pop_total.y_2001 as y_2001, </B><SPAN style=""><FONT class="Apple-style-span" face="Helvetica-Bold"><B>geometric_table</B></FONT><B>.the_geom AS the_geom, pop_total.oid AS oid FROM pop_total, </B><SPAN style=""><FONT class="Apple-style-span" face="Helvetica-Bold"><B>geometric_table</B></FONT><B> WHERE </B><SPAN style=""><FONT class="Apple-style-span" face="Helvetica-Bold"><B>geometric_table</B></FONT><B>.id = pop_total.id) AS foo USING UNIQUE oid USING srid=-1' </B></SPAN></SPAN></SPAN></DIV><DIV><B><BR class="khtml-block-placeholder"></B></DIV><DIV>Think this is alright....</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Stef</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style="">Hi there,</SPAN></P><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style="">I am only starting to understand the functionality of Postgis. Although I got the first real-world examples running, I have difficulties imaging something: As I am dealing with hundreds of (for the moment still) shapefiles where only the dbf is different (statistical data on national level), I wonder how to use postgis to accomplish the same thing but only with one geometric table.</SPAN></P><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style="">What I wonna say is this: I guess I have to load only once the shapefile, so that I can use my national statistics postgres tables to link to this geometric table via a join, something like: </SPAN></P><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style=""><SPAN style="mso-tab-count:1">            </SPAN><SPAN style="mso-tab-count:1">            </SPAN><SPAN style="mso-tab-count:1">            </SPAN></SPAN><SPAN style=""><FONT class="Apple-style-span" face="Helvetica-Bold"><B>DATA 'geometric_table .the_geom, pop_total.y_2001 from geometric_table, pop_total WHERE geometric_table.id = pop_total.id' </B></FONT></SPAN><SPAN style=""><FONT class="Apple-style-span" face="Helvetica-Bold"><B> </B></FONT><FONT class="Apple-style-span" face="Helvetica-Bold"><O:P></O:P></FONT></SPAN></P><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style="">But this then suddenly results in multiple WHERE clauses: </SPAN></P><P class="MsoNormal" style="mso-pagination:none;mso-layout-grid-align:none; text-autospace:none"><SPAN style=""><B>Warning: [MapServer Error]: prepare_database(): Error executing POSTGIS DECLARE (the actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT y_2001::text,asbinary(force_collection(force_2d(geometric_table.the_geom, pop_total.y_2001)),'XDR'),OID::text from geometric_table, pop_total WHERE geometric_table.geo_id = pop_total.id WHERE geometric_table.the_geom, pop_total.y_2001 &amp;&amp; setSRID('BOX3D(-180 -90,180 90)'::BOX3D, find_srid('','geometric_table, pop_total WHERE geometric_table.geo_id = pop_total.id','geometric_table.the_geom, pop_total.y_2001') )' </B><O:P></O:P></SPAN></P><DIV><B><BR class="khtml-block-placeholder"></B></DIV><DIV>Can anyone let me know how this works?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks a lot!</DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>