Getting concatenated attribute values from Spatial Join
One solution is to create a Virtual Layer and write some SQL.
Type the following query into the Query section of the dialog:
SELECT c.geometry, c.CITY_NAME, group_concat(z.code) AS ZIP_ids
FROM ZIPCODE z, CITY_AREA c
WHERE ST_Intersects(z.geometry, c.geometry)
GROUP BY c.CITY_NAME;
Adjust field names in the query. For example, I assumed ZIP codes are stored in the code
field of your ZIPCODE layer. Test the query.
Choose proper values for other options such as Geometry column, type, and CRS. Finally, click OK
.
You should get a new layer with concatenated ZIP ids for each CITY_AREA.