<p dir="ltr">It's ab SQL error</p>
<p dir="ltr">Try<br>
WITH <br>
positiu AS (<br>
    SELECT rid, ST_Reclass(ST_Band(rast, 1), 1, '[1-10000]:1', '16BSI', 0) ad rast<br>
    FROM rastertmp.prova<br>
</p>
<div class="gmail_quote">Il 31/lug/2015 12:44, "juli g. pausas" <<a href="mailto:juli.g.pausas@uv.es">juli.g.pausas@uv.es</a>> ha scritto:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi<br></div>I'm slowly learning postgis ... <br></div>I have these 3 SELECTS that works well when run independently, but I'm now trying to use them together in a WITH query, and I cannot make it run. What I'm doing wrong?<br><br>WITH <br>positiu AS (<br>    SELECT rid, ST_Reclass(ST_Band(rast, 1), 1, '[1-10000]:1', '16BSI', 0) <br>    FROM rastertmp.prova<br>),<br>isok AS (SELECT t1.rid, ST_Union(ST_Intersection(t1.rast, 1, t2.rast, 1, 'BAND1'))<br>    FROM rastertmp.prova AS t1, positiu AS t2<br>    WHERE ST_Intersects(t1.rast, t2.rast)<br>        GROUP BY t1.rid<br>),<br>clips AS (<br>    SELECT p.ecoregion_cod, ST_Union(ST_Clip(r.rast,1, p.geom, true)) AS rast<br>    FROM gis_wd.wd_ecoregiones AS p, isok AS r<br>    WHERE ST_Intersects(r.rast, p.geom)<br>    GROUP BY ecoregion_cod <br>)<br>SELECT ecoregion_cod, (ST_SummaryStats(rast, 1)).* FROM clips <br><br>-- ERROR: column t2.rast does not exist<br><br><br><div>In fact, I'm assuming that running these SELECTS in a single WITH query is more efficient (faster?) than running each one separately, generating intermediate tables (less disk access?). But perhaps I'm wrong, any idea?<br></div><div><div><div><br>Thanks<br></div><div><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr">Juli<div><span style="color:rgb(51,51,153)">--</span><br><font color="#333399"><b>CIDE, CSIC</b>  |  <a href="http://www.uv.es/jgpausas" target="_blank">www.uv.es/jgpausas</a>  | <br><br></font></div></div></div></div></div></div>
</div></div></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div>