<div dir="ltr">Thank you Charles! Your example really works and I very quckly managed to achieve what I intended.<br><br>BUT it is a different thing - you make a join during constracting the layer and I suppose that it should affect how a layer looks like. <br>
<br>I was asking about the JOIN object of the mapfile, that according to the documentation cannot affect the look of a layer and gives results only whan the layer is queried. I tried simpler JOIN with a csv file which give no results eighther.<br>
<br>Someone has any idea?<br><br><div class="gmail_quote">On Fri, Sep 5, 2008 at 10:29 PM, Charles Theobald <span dir="ltr">&lt;<a href="mailto:charles.theobald@ncmail.net">charles.theobald@ncmail.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">We do that kind of join with a lot of our data. &nbsp;Here&#39;s a code snippet from a polygon layer in one of our maps:<br>

<br>
LAYER #Service area poly layer starts here<br>
 &nbsp; NAME Service_areas<br>
 &nbsp; CONNECTIONTYPE ogr<br>
 &nbsp; CONNECTION &quot;/path/to/shape/file/on/mapserver/cpws.shp&quot;<br>
 &nbsp; DATA &quot;SELECT * FROM cpws LEFT JOIN &#39;MYSQL:databasename,host=mysqlhostname,user=mysqluseraccount,password=mysqluserpassword&#39;.sysstatus ON <a href="http://cpws.id" target="_blank">cpws.id</a> = sysstatus.permit&quot;<br>

<br>
*cpws is the shape file (on the map server), and sysstatus is a table on our MySQL server (different boxes); the join is being performed on <a href="http://cpws.id" target="_blank">cpws.id</a> and sysstatus.permit. <br>
Hope this helps.<br>
<br>
<br>
<a href="mailto:mapserver-users-request@lists.osgeo.org" target="_blank">mapserver-users-request@lists.osgeo.org</a> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send mapserver-users mailing list submissions to<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:mapserver-users-request@lists.osgeo.org" target="_blank">mapserver-users-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:mapserver-users-owner@lists.osgeo.org" target="_blank">mapserver-users-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of mapserver-users digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
 &nbsp; 1. JOIN in a mapfile from a shapefile to a MySQL &nbsp; &nbsp; database<br>
 &nbsp; &nbsp; &nbsp;(Minka Stoyanova)<br>
 &nbsp; 2. High CPU (Steve White)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 5 Sep 2008 19:13:39 +0300<br>
From: &quot;Minka Stoyanova&quot; &lt;<a href="mailto:minka.stoyanova@gmail.com" target="_blank">minka.stoyanova@gmail.com</a>&gt;<br>
Subject: [mapserver-users] JOIN in a mapfile from a shapefile to a<br>
 &nbsp; &nbsp; &nbsp; &nbsp;MySQL &nbsp; database<br>
To: <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
Message-ID:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;<a href="mailto:66b0a28d0809050913k16c6864cj47ef8ddb6e113b31@mail.gmail.com" target="_blank">66b0a28d0809050913k16c6864cj47ef8ddb6e113b31@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<div><div></div><div class="Wj3C7c"><br>
<br>
Hello,<br>
<br>
It&#39;s the first time i try to make a JOIN in a mapfile layer. I want to query<br>
a mysql database for some attributes (columns) of a selected point from the<br>
point layer.<br>
<br>
This is the layer definition:<br>
<br>
 &nbsp;LAYER # States point layer 1 begins here<br>
 &nbsp; &nbsp;NAME &nbsp; &nbsp; &nbsp; &nbsp; &quot;meteostations&quot;<br>
 &nbsp; &nbsp;DATA &nbsp; &nbsp; &nbsp; &nbsp; meteostationstotal_11<br>
 &nbsp; &nbsp;STATUS &nbsp; &nbsp; &nbsp; ON<br>
 &nbsp; &nbsp;TYPE &nbsp; &nbsp; &nbsp; &nbsp; POINT<br>
 &nbsp; &nbsp;CLASS<br>
 &nbsp; &nbsp; &nbsp;SYMBOL &#39;circle&#39;<br>
 &nbsp; &nbsp; &nbsp;SIZE 8<br>
 &nbsp; &nbsp; &nbsp;COLOR 255 0 0<br>
 &nbsp; &nbsp; &nbsp;OUTLINECOLOR 0 0 0<br>
 &nbsp; &nbsp;END<br>
 &nbsp; &nbsp;TEMPLATE &quot;sometemplate.html&quot; TOLERANCE 3 TOLERANCEUNITS PIXELS<br>
 &nbsp; &nbsp;METADATA<br>
 &nbsp; &nbsp; &nbsp;&quot;DESCRIPTION&quot; &nbsp; &nbsp;&quot;Meteo stations&quot;<br>
 &nbsp; &nbsp; &nbsp;&quot;RESULT_FIELDS&quot; &nbsp;&quot;A sin_kod NAME IME longi X_COO lat Y_COO&quot;<br>
# the result fields are mixed - the* names of some columns* from the<br>
shapefile and from the database<br>
 &nbsp; &nbsp;END<br>
 &nbsp; &nbsp;JOIN<br>
 &nbsp; &nbsp; &nbsp;NAME FirstJoin<br>
 &nbsp; &nbsp; &nbsp;CONNECTION<br>
&#39;MYSQL:meteo,host=some_IP,user=myuser,password=mypassword,tables=bgc&#39;<br>
 &nbsp; &nbsp; &nbsp;CONNECTIONTYPE ogr<br>
 &nbsp; &nbsp; &nbsp;FROM A<br>
 &nbsp; &nbsp; &nbsp;TABLE bgc<br>
 &nbsp; &nbsp; &nbsp;TO sin_kod<br>
 &nbsp; &nbsp; &nbsp;TYPE ONE-TO-ONE<br>
 &nbsp; &nbsp;END<br>
 &nbsp;END # States point layer 1 ends here<br>
<br>
I receive no error (neighther in the mapserver.log file, nor in the web<br>
server logs) BUT I don&#39;t receive any info from the database.<br>
<br>
Thanks in advance!<br></div></div>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080905/64c07317/attachment-0001.html" target="_blank">http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080905/64c07317/attachment-0001.html</a><br>

<br></blockquote></blockquote></div><br></div>