After successfully running an SQL query on two tables and some results in 3 columns, I would really like to be able to display it in the canvas. Apparently, that function is not doing anything, not even as much as throwing an error so as to know if something is happening.

What should I do? Hopefully this screenshot will help.

enter image description here

*I'm using the DB manager because the SPIT plugin was not allowing me to import shapefiles. *QGIS version 2.8.2 on Windows

After several attempts, I managed to create a table with my results, however it's not what I was aiming for.

create table results as (SELECT bati_1948.objectid gid48,bati_1971.objectid gid71,ST_Area(ST_Intersection(bati_1948.geom,bati_1971.geom))/ST_Area(bati_1971.geom) ratio FROM bati_1948 RIGHT JOIN bati_1971 ON ST_DWithin(bati_1948.geom,bati_1971.geom,5) WHERE bati_1948.objectid IS NULL OR ST_Area(ST_Intersection(bati_1948.geom,bati_1971.geom))/ST_Area(bati_1971.geom)<>1);

Would anyone know how could I turn this into a shapefile?

2 Answers 2


You need to have a geometry column output in your query. Looks like you don't.


On my version (2.16.3), if i untick the box next to 'Geometry Column', i can load as a new layer the result of a query without any problem even though it does not have any geometry data...

  • At that point I don't believe I was aware of that function. Can't remember if 2.08.2 had it or not. Thanks for mentioning that though.
    – Geosphere
    Commented Dec 13, 2016 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.