Q:

QGIS expression to check if a an attribute value of a feature exist in another attribute column

I have a shapefile with two fields 'Name' and 'CountyFacilityID'. I would like to create an expression to select all features where Name exists in the CountyFacilityID column for any of the features.
I tried array_contains( "CountyFACILITYID" ,  "NAME" ) but it didn't work as it is not considering FacilityID as an array

A:

You have to aggregate the values of the other column first. For example like this:
array_contains( array_agg( "CountyFACILITYID" ), "Name" )

