<div dir="ltr">Hello, I'm learning SQL/PostGIS and I need some help...<br><div><br>I have a table (Table1) with different fields (but no geometry field). This table has already 35 rows of values.<br><br>I
 imported a second Table to the same database in pgAdmin using 
pgShapeLoader. This second table has a geom field that I want to add to 
Table1. The idea is to convert a non-spatial table to spatial<br><br>I created a geom field in Table 1 using AddColumn:<br>

<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><br></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal">

</p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA">SELECT AddGeometryColumn('UDE_spatial','public','table1','geom',4326,'POINT',2);</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><br><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal">Now, I'm trying to add the values from geom field in Table 2 to geom field in Table 1:<br><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA">INSERT INTO Table1(geom)</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA">SELECT geom</span></p>

<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA">FROM Table2;</span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><br><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"><span style="color:rgb(0,0,0)">There
 are 35 rows to add and a common field 'FabID'. My surprise is that 
instead of adding the values in the rows from 1 to 35, it starts in the
 row number 36. It seems like you only could use INSERT INTO...SELECT 
when you want to add fieldsĀ  to a new table with no values 
added yet. I don't know how to write the sentence in the way I need. I tried adding...WHERE fabid BETWEEN 1 AND 35.</span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><br><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"><span style="color:rgb(0,0,0)"></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"><span style="color:rgb(0,0,0)">Well, that's probably a very simple question for most of you but I'm getting crazy...lol<br></span></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><br><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"><span style="color:rgb(0,0,0)"></span></span></p><span style="font-size:10pt;color:rgb(0,112,192)" lang="CA"><span style="color:rgb(0,0,0)">Thanks</span></span></div></div>