<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">To Etienne -<br>
<br>
If you don't do it "The SQL way" you'll probably get into trouble
with duplicate key values for the primary key index in your
spatialite tables. <br>
<br>
I assume:<br>
<ul>
<li>That your tables - let's call them TABLE_A and TABLE_B has
exactly the same structure</li>
<li>All tables has a integer primary key column - lets call it
OGC_FID</li>
<li>You want to add the rows of TABLE_B to TABLE_A<br>
</li>
</ul>
<p>The you can do the following:<br>
</p>
<ol>
<li>Open the dbmanager in QGis (<b>Menu Database</b> --> <b>DB
Manager</b> --> <b>DB manager</b>). QGIS shows a
dialog-window "DB Manager"</li>
<li><b>Double-click</b> on the spatialite database you want to
work with in the selection tree (left side of the "DB Manager"
dialog) and push the <b>F2</b> on the keyboard. QGis shows
another dialog-window "SQL window - <i>database name</i>"</li>
<li>Write "<b>select max (OGC_FID) from TABLE_A"</b> in the
"query" window and push the <b>F5</b> button to execute the
query. Remember the result value.</li>
<li>Write "<b>update</b> <b>TABLE_B set OGC_FID = OGC_FID + </b><i>maxA</i><b>
+ 1" </b>in the "query" window and push the <b>F5</b>
button to execute the query<b>. First </b>replace <i>maxA </i>with
the found value from step 3. This query will guarantee, that
there is no identical OGC_FID values in the two tables.</li>
<li>Write <b>"insert into TABLE_A select * from TABLE_B"</b> in
the "query" window and push the <b>F5</b> button to execute
the query. This query will copy the rows from TABLE_B and
append them to TABLE_A.</li>
<li>Repeat steps 3 - 5 and replace TABLE_B with the names of the
other tables you want to add to TABLE_A. </li>
</ol>
<p>Tip: Write all the SQL commands into a text-editor (ex.
notepad) and copy-paste them one-by-one into the query window.
It can save you for a lot of grief. <br>
<br>
Regards<br>
Bo Victor Thomsen<br>
Aeastas-GIS<br>
Denmark<br>
</p>
<br>
<br>
Den 27-08-2012 23:44, Etienne Tourigny skrev:<br>
</div>
<blockquote
cite="mid:CA+TxYvPVGpb_iYw=d93fKGne4OBv9rK_skRLYy3_ddTnSuEqBw@mail.gmail.com"
type="cite">
<pre wrap="">Hi all,
I have a number of spatial tables in spatialite DB, each with similar
data, that I want to merge into a single table. I don't want to join
them, but have a single table/view with data from all tables.
I know this can be achieved through sql commands, but is there an easy
(GUI) way to insert content from one table into another?
Thanks,
Etienne
_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<br>
</body>
</html>