Hi Randy,
This might work in QGIS 3 - it's untested because I'm currently on a machine 
with QGIS 2.18 (where the @parent variable is unavailable)

aggregate( 'LAYER2','count',"NAME","NAME"=attribute(@parent, 'NAME')) > 0

The other way might be to create a join to your target layer and then select 
the rows where the value of joined column is not null.

Cheers,
Martin.

From: Qgis-user [mailto:[email protected]] On Behalf Of 
Altergott, Randy (CCI-Southwest)
Sent: Tuesday, 18 June 2019 3:41 AM
To: [email protected]
Subject: [Qgis-user] Select by Expression with Subquery

Hi QGIS users,
I'm new to QGIS and this is my first question.
Can I use QGIS "Select by Expression" to select all features in a vector layer 
where the "name" field value is also found within another layer (delimited text 
layer with no geometry)? I get a syntax error when using the following SQL.

"NAME" IN (SELECT "NAME" FROM 'LAYER2')

I'm using the "Map Layers" menu to add the layer name, so it actually displays 
something like 'LAYER2_ca36271a_8ec7_4aa7_a36c_67418104f66c' instead of just 
'LAYER2'.

Thanks,
Randy

_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to