<div dir="ltr"><div><div><div><div>Hi,<br></div>sorry for the delay. It's advised to answer to the group so that anybody can answer you or benefits from the answers.<br><br></div>Sure you can map the original layer and the  subsets. Give a look to "Join" [0] tab in the layer properties.<br></div>Once joined you can use the field calculator to fill the type field doing something like (for each subset)<br></div>_case when type is null then SubsetTypeField end_<br><div><div><br>[0] <a href="http://docs.qgis.org/2.8/en/docs/user_manual/working_with_vector/vector_properties.html#joins-menu">http://docs.qgis.org/2.8/en/docs/user_manual/working_with_vector/vector_properties.html#joins-menu</a><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-03 13:27 GMT+02:00 Stephan Weiser <span dir="ltr"><<a href="mailto:stephan.weiser@gmx.com" target="_blank">stephan.weiser@gmx.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="#954F72" lang="DE"><div><p class="MsoNormal">Hey Harrissou,</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">thank you so much, that worked!!! Sorry for that too easy question, I am a Newbe in QGIS and did not know the field calculator feature.</p><p class="MsoNormal">What I can do now is Setting the type-field to the string I wish<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p><u></u><span style="font-family:Wingdings"><span>è<span style="font:7.0pt "Times New Roman""> </span></span></span><u></u>buildingsTypeA gets type= btA<u></u><u></u></p><p><u></u><span style="font-family:Wingdings"><span>è<span style="font:7.0pt "Times New Roman""> </span></span></span><u></u>buildingsTypeB gets type= btB<u></u><u></u></p><p><u></u><span style="font-family:Wingdings"><span>è<span style="font:7.0pt "Times New Roman""> </span></span></span><u></u>buildingsTypeC gets type= btC<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">It would be perfect if I could map the new type values of buildingsTypeA, buildingsTypeB, buildingsTypeC to the „raw“ shapefile buildings which contains all the shapes (A+B+C+rest).<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Is that possible with field calculator, too? So, I Need a kind of „set type in layer building from layers buildingsTypeA, buildingsTypeB, buildingsTypeC. Othewise I would have to reselect the 5000+ shapes again based on the raw shape file.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Best regards,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Stephan</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal" style="border:none;padding:0cm"><b>Von: </b><a href="mailto:delazj@gmail.com" target="_blank">DelazJ</a><br><b>Gesendet: </b>Sonntag, 3. Juli 2016 12:52<br><b>An: </b><a href="mailto:stephan.weiser@gmx.com" target="_blank">Stephan Weiser</a><br><b>Cc: </b><a href="mailto:qgis-user@lists.osgeo.org" target="_blank">qgis-user@lists.osgeo.org</a><br><b>Betreff: </b>Re: [Qgis-user] SQL Updates on virtual layer shape file attribute failes</p></div><div><div class="h5"><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p><div><div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">Hi</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u><u></u></span></p></div><p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">Stephan, why not use the Field Calculator (with a Case When statement or an expression-based selection beforehand)?<u></u><u></u></span></p></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">Harrissou<u></u><u></u></span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p></div></div><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">2016-07-03 11:25 GMT+02:00 Stephan Weiser <<a href="mailto:stephan.weiser@gmx.com" target="_blank">stephan.weiser@gmx.com</a>>:<u></u><u></u></span></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">Hey there,<u></u><u></u></p><p class="MsoNormal"> </p><p class="MsoNormal">I am using QGIS 2.14.1 (Essen). In order to create a city scenery for a Flight Simulator, I need to process shp-files.</p><p class="MsoNormal">The shape files I use are the shape files of open street map. For a certain city loaded the shp file into QGIS with the name „buildings“. For the Flight Simulator I have to define several „classes“ of buildings using the „type“ attribute of a single shape. As the shape file I downloaded is only poorly descripted (most „types“ are NULL), I want to overwrite the „type“ Attribute with the proper names To make it easy for you, i have the following shape files als QGIS virtual layers:</p><p class="MsoNormal"> </p><p>-<span style="font-size:7.0pt">        </span>„buildings“ (the downloaded shp file -> original layer with all Buildings)</p><p>-<span style="font-size:7.0pt">        </span>„buildingsTypeA“ (a subset of „Buildings“ with target „type“ „btA“)</p><p>-<span style="font-size:7.0pt">        </span>„buildingsTypeB“ (a subset of „Buildings“ with target „type“ „btB“)</p><p>-<span style="font-size:7.0pt">        </span>„buildingsTypeC“ (a subset of „Buildings“ with target „type“ „btC“)</p><p class="MsoNormal"> </p><p class="MsoNormal">The „buildingType“ Layers have been created by selecting the proper shapes in „Buildings“ and copying them into a new virtual layer.</p><p class="MsoNormal"> </p><p class="MsoNormal">As every building shape of A, B and C occur in „Buildings“ I tried to write a simple SQL update Statement like this. All the virtual layers have the same structure (osm_id, name, type, geometry)</p><p class="MsoNormal"> </p><p class="MsoNormal">UPDATE buildings</p><p class="MsoNormal">SET type = 'btA‘</p><p class="MsoNormal">WHERE buildings.osm_id IN (SELECT osm_id from buildingsTypeA)</p><p class="MsoNormal"> </p><p class="MsoNormal">The same should be done for buildingsTypeA and buildingsTypeA.</p><p class="MsoNormal"> </p><p class="MsoNormal">When I exectute the Statement, I get an error: „<span style="font-family:"Courier New,courier",serif">near "update": syntax error“. Simple SELECT Statements work. To simplify it further I also noticed that e.g the following query resulted in the same error</span></p><p class="MsoNormal"><span style="font-family:"Courier New,courier",serif"> </span></p><p class="MsoNormal">UPDATE <span style="font-family:"Courier New,courier",serif">Buildings</span></p><p class="MsoNormal"><span style="font-family:"Courier New,courier",serif">Set type =‘abc‘</span></p><p class="MsoNormal">WHERE buildings.osm_id = '12345567‘</p><p class="MsoNormal"><span style="font-family:"Courier New,courier",serif"> </span></p><p class="MsoNormal"><span style="font-family:"Courier New,courier",serif">So my questions are:</span></p><p class="MsoNormal"><span style="font-family:"Courier New,courier",serif"> </span></p><p>-<span style="font-size:7.0pt">        </span><span style="font-family:"Courier New,courier",serif">Does the Database Manager Plugin for QGIS only Support Select Statements (Read Only)?</span></p><p>-<span style="font-size:7.0pt">        </span>If yes, is there a different way to edit the data in batch mode? (round about 5000 buildings have to be updated)</p><p>-<span style="font-size:7.0pt">        </span>Are there other ways to Access shp-files in a SQL-like manor to perform that UPDATE Statements?</p><p class="MsoNormal"> </p><p class="MsoNormal">Hope you can help me out here.</p><p class="MsoNormal"> </p><p class="MsoNormal">Best regards,</p><p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p><p class="MsoNormal"><span style="color:#888888">Stephan<u></u><u></u></span></p><p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p><p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#888888"> </span><span style="color:#888888"><u></u><u></u></span></p><p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:#888888"> </span><span style="color:#888888"><u></u><u></u></span></p></div></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><br>_______________________________________________<br>Qgis-user mailing list<br><a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><u></u><u></u></span></p></blockquote></div></div><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><u></u> <u></u></span></p><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></blockquote></div><br></div>