2

I'm trying to create a virtual layer starting from a municipality layer and from a table of attributes, both stored in a Postgresql DB.

So I've done a join like:

*SELECT munic, country_of_origin, SUM (presence), munic.NOME
FROM ps JOIN munic ON munic.pro_com = ps.pro_com
WHERE country_of_origin = 'Germany'
GROUP BY munic.NOME
ORDER BY munic.NOME DESC*

I've set the geometry fields in the mask, I see the join in the attribute table, but I can't see the map

Any ideas?

  • 3
    "even if i've set the geometry fields in the mask" ... what do u mean ? – snaileater May 23 '18 at 13:10
  • 2
    Do you need to add a geometry field to your selection? In a quick test, doing "SELECT ID from foo" fails, but "SELECT ID,ID.geometry from foo" works for me. ("SELECT * from foo" also works) – Spacedman May 23 '18 at 13:16
  • 1
    It's not enough to list the geometry column -- if a GROUP BY is present, you need to use an aggregation function on the geometry (or to restructure so that the geometry is outside the aggregation). – Vince May 23 '18 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.