QGIS how to select entries not in another layer

You can achieve that using an SQL Query in the DB Manager of QGIS.

You choose Database / Database Manager / Database Manager then Virtual Layers / Qgis Layers you can then try queries like the following :

select ID from layer1 where ID not in (select ID from layer2)

Depending on the size of your tables it can be a bit time consuming ...


You could also filter by expression using the Advanced Filter in the Attribute Table (of layer1):

get_feature_by_id('layer2',$id) IS NULL

This will filter out the features of layer1 whose $id is not found in layer2.

Note: $id refers to the current feature's id, as assigned automatically within QGIS. As noted by @Mike D, you may want to use another attribute as identifier, in which case you need to put double-quotes around its name (single-quotes point to an attribute, double-quotes point to its value). For the example below, we could have written the filter expression as follows

get_feature_by_id('layer2',"CODE_OBJ") IS NULL

Advanced Filter