I'm using QGIS 2.18.16 and i'm learning to use the query builder to create my own layers. I have noticed two separate fields (name, building) which have similar category of values such as "schools, train station, shops, libraries". I'm seeking to have one query that combines both fields, allowing the creation of one layer which I can then categorise.

How do I create this query?

  • 1
    How do you want to combine these fields?
    – Erik
    Feb 21 '18 at 11:13
  • I have two layers: "building" IN ('central_office', 'commercial', 'public', 'train_station') "name" IN ('Inverness Bus Station', 'Inverness Library', 'Rose Street Multi Storey') I'd like them in one query, one layer (currently). It is the same for restaurants, several restaurant values appear in different fields, I'm seeking to combine.
    – McGraw
    Feb 21 '18 at 11:22
  • @McGraw - Are both your layers of the same geometric type (i.e. both polygon layers)? If so, you may need to merge them into a single layer and then use your query with the OR operator: "building" IN ('central_office', 'commercial', 'public', 'train_station') OR "name" IN ('Inverness Bus Station', 'Inverness Library', 'Rose Street Multi Storey')
    – Joseph
    Feb 21 '18 at 12:33

I suggest you try the "join attributes by location" feature, this adds all attributes of any intersecting/crossing layer to your baselayer, e.g. all names of restaurants to the building layer. This works only with spatial data, if you only have tables, you will have to venture deeper into SQL, e.g. building a virtual layer.

Your Answer

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

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