Using QGIS it is possible to easily label features from related tables with a 1 to 1 JOIN. If the relationship is one to many and Project Properties RELATIONS are defined, then only the last related entry seems to be available for labeling (this is only available if a JOIN is also defined). For example, if I have a feature set called Countries with field called Country as the related (key) field and a related table fields Country and Flag_Colors, how could I do a label like this: "Name: United States Colors: Red, White, Blue" I'm hoping since the Attribute Table Form has Expressions and the Feature ID panel both count and display the 3 colors (i.e. related records) there is some type of SQL expression that can get the kind of Feature label I am describing. See attached screen shot of the current limits of my labeling attempt.

Ay suggestions or ideas?

enter image description here

  • Take a look at the relation_aggregate function with concatenate as the aggregation type.
    – Matt
    Commented Apr 17, 2023 at 6:07

1 Answer 1


First, you need to create a relation between the two tables via "Project -> Properties->Relations": enter image description here

Next, you can use the following expression to label each country with all responding child features and their respective color:

 'Name: ' || "CNTRY_NAME"  || ' Colors: '|| relation_aggregate(relation:='Country_Colors',aggregate:='concatenate',expression:="Color", concatenator:=', ')

enter image description here

  • Thanks to you all for helping with this one. I'd never heard of this call. but it did just what I was hoping for.
    – Zapper
    Commented Apr 18, 2023 at 13:13

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.