On QGIS Attribute Forms, I want to display related Features which are connected via a many-to-many relationship table:

Tables / QGIS Layers:

Feature a: a_id, geometry, some more attributes

Feature b: b_id, geometry, some more attributes

Join table: join_a_to_b: a_id, b_id

Now I define one-to-many-Relations via Project Properties:

Relation 1: Parent: Feature a, Child: Join Table referencing a_id

Relation 2: Parent: Feature b, Child: Join Table, referencing b_id

This way I can show all connected join table entries in the attribute form, but I do not manage to show connected Features of type "b" directly in an "a" attribute Form.

From the docs, this should be possible this way - any hints what I'm doing wrong? Swapping Parent and Child wont work either.

Using QGIS 3.4.3 on Windows 7 (same behaviour with Linux) on top of PostgreSQL

2 Answers 2


Two more steps are necessary to get it work:

1) Edit Layer Properties, go to Attribute forms. Set Cardinality of the relation from "Many-to-one" to the target table ("b" in my Example)

2) set Attribute form to "Design by drag'n'Drop and pull the relation into the list of displayed attributes.

If you do that on both sides of the m-n relationship, you see directly the connected features of the other side, and no more entries of the intermediate join tables are shown in the attribute form.


If your relations are defined correctly (it seems correct from the info in your post), you should see a button in feature form that opens related record from layer B next to ID of that related feature. The button looks like this:

enter image description here

On example above, I have a building with ID 979 (that is my feature A) and owner with ID 3606. They are joined in a join table under record with ID 5031 that looks like this: (id, building_id, owner_id).

And, here is a good article about relations if that is your concern. This exact part:

a) Create the relation: - Project Properties > Relations > Add - referencing layer = the table with the “many” records - referencing field = the referencing layer’s relate field - referenced layer = the table with the “one” record - referenced field = the referenced layer’s relate field - id = typically leave blank

b) Then use the QGIS Identify tool. ArcMap uses either the geometry select or attribute select. - Make sure that the layer of interest is highlighted in the TOC - After selecting a feature, a Feature Attributes window will pop up. You get a separate window for each feature selected, and you have to close this window to turn off the id color on the map. Not sure how to export the window’s contents.

And finally, if you want to display data from feature B in attribute table of feature A, you need to do it with a JOIN, defining relations wont solve that for you.

  • This solution still shows the intermediate join table which I want to avoid. Commented Feb 7, 2019 at 14:41
  • Thank you! I thought "join" would only work for one to one relationships? Commented Sep 11, 2020 at 7:09

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.