I would like to display all texts that are assigned to an element as a label. Normally, the last hit in the table is always used as the caption.

Description of the problem. There is a layer of properties. (polygons) Each lot has a unique identifier.

There is then a linked table for this, which contains the owners. The owners are also determined via the property number.

However, there can be more than ONE owner per lot!

How is an output by label with all owners possible?

Table property

lot ID Gemarkung Flur Flurstück Area
099 585/10/259 585 10 259 1000
099 585/10/300 585 10 300 100
099 585/10/310 585 10 310 300

Table Owner

lot ID Firstname Lastname
099 585/10/259 John Dow
099 585/10/259 Julia Dow
099 585/10/259 Lisa Simpson
099 585/10/300 Marge Simpson
099 585/10/300 Homer Simpson
099 585/10/300 Lisa Simpson
099 585/10/310 Bart Simpson

Tables are already linked

qGIS 3.16.10-Hannover

  • Just to be sure, you are using one of the latest versions of QGIS3? Aug 3 at 6:37
  • qGIS 3.16.10-Hannover LTR is used.
    – Sven
    Aug 3 at 6:40

2 Answers 2


If you are using a database backend for your data, you may be able to do a query like the one @RainForest proposed, that may even be the best way of doing it, but the exact syntax may depend on your database backend. If so, please indicate in your question which backend you are using.

If you for some reason prefer to or need to do this entirely in QGIS:

It may be that you need to remove the join on the tables to get this to work. In the label dialog, press the curly E beside the value field to get the expression window and type in

aggregate(layer:='Owner', aggregate:='concatenate', 
expression:=concat("Firstname",' ',"Lastname"), 
filter:="lot ID" = attribute(@parent,'lot ID'), concatenator=', ')

This will just give you the labels printed on the map. If you also want to be able to search the labels, you would need to create a calculated field in your property table and use the same formula for that


Open "Owner" table in DB manager.

Create query:

  SELECT Group_Concat(Owner."Firstname" || ' ' || Owner."Lastname" ) as labels,
  Owner."Lot ID"
  FROM Owner
  group by Owner."Lot ID"

Load result as new layer - "Owners".

Link "property" to "Owners".

Use "Owners".labels as labels for your layer.

  • I think this only will work is the backend is mysql / mariadb.. Aug 3 at 11:03
  • And wouldn't it give "John DowJulia Dow" as label for the first parcel in the example? I guess the OP would like "John Dow, Julia Dow" - at least if it is to be used for anything else than an internal overview Aug 3 at 11:14
  • Group_Concat create comma separated string as I know
    – RainForest
    Aug 3 at 11:22
  • It would be nice if all entries in table (Owner) were displayed for each entry in table (property). is it possible for labels with the "expression dialog" to search the table by value or to be read into an array. The array could then certainly be output via foreach.
    – Sven
    Aug 3 at 11:23
  • the solution works. Duplicate values ​​are sometimes displayed. It is also possible that the table contains duplicate values
    – Sven
    Aug 3 at 12:07

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.