Coalesce field "X" if field "Y" is a duplicate

With credit to Vince, the correct expression to use in this case was:

concatenate( to_string( "ID" ),group_by:="X, Y",  concatenator:='|')

In QGIS I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there is a point layer with it's corresponding attribute table, see image below.

input

With the following query, it is possible to achieve the result.

SELECT "X, Y", GROUP_CONCAT(info, ' | ') AS info_concat
FROM "points"
GROUP BY "X, Y"

The output Virtual Layer will look like as following

result

Note: Geometry is not included in the final output, otherwise extend the query with geometry parameter and to check how many points were grouped insert COUNT(), i.e.

SELECT "X, Y", GROUP_CONCAT(info, ' | ') AS info_concat, geometry, COUNT("X, Y")  AS pperloc
FROM "points"
GROUP BY "X, Y"

References:

  • SQLite GROUP_CONCAT
  • W3Schools | SQL COUNT(), AVG() and SUM() Functions