I have change the SQL to this one:<div><br></div><div><div>SELECT  "Pipeline".the_geom AS the_geom,</div><div>        "Pipeline".gid AS gid,</div><div>        "Pipeline".status AS status,</div>
<div>        "Kondur_block".id_wk AS id_wk</div><div>FROM    "Pipeline"</div><div>LEFT JOIN "Kondur_block"</div><div>ON     "Pipeline".id_wk = "Kondur_block".id_wk</div></div>
<div><br></div><div>and it works on psql, but when I tried that SQL to map file, it give me this message:</div><div><br></div><div><span style="font-family:'Times New Roman';font-size:medium;background-color:rgb(255,255,255)">msDrawMap(): Image handling error. Failed to draw layer named 'Pipeline'. msPostGISLayerWhichShapes(): Query error. Error executing query: ERROR: syntax error at or near "Pipeline" LINE 1: ...e(ST_AsBinary(ST_Force_2D("the_geom FROM (SELECT "Pipeline".... ^</span>
</div><div><br></div><div>What I am missing on my mapfile? here is my mapfile :</div><div><div>    CONNECTIONTYPE postgis</div><div>    CONNECTION "dbname='Melibur' host=localhost port=5432 user=' '   password=' ' sslmode=disable"</div>
<div>    DATA 'the_geom FROM<span class="Apple-tab-span" style="white-space:pre">   </span>(SELECT "Pipeline".the_geom AS the_geom,      "Pipeline".gid AS gid, "Pipeline".status AS status, "Kondur_block".id_wk AS id_wk FROM "Pipeline" LEFT JOIN "Kondur_block" ON "Pipeline".id_wk = "Kondur_block".id_wk) as subquery USING UNIQUE gid USING srid=32648'</div>
</div><div><br></div><div><br></div><div>Thanks,</div><div>Surahman</div>