Last active
June 14, 2022 19:20
-
-
Save kylefelipe/b3b93611cc999ad3a001e221e59a6e2b to your computer and use it in GitHub Desktop.
Selecting features from table A using table B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Expression to be used at SELECT BY EXPRESSION AT LAYER A | |
array_contains( -- This will return true if the array contains the value | |
aggregate( -- will aggregate all values from target in to a string, using semicolons as concatenator | |
layer:='<table_b>', -- Target table containing the values, replace <table_b> whith your table name | |
aggregate:='array_agg', | |
expression:=to_string("<field_from_table_b>"), -- Field from table_b containing the values | |
), | |
"<field_table_a>") -- Field from table a with values to compare, replace <field_table_a> with your field name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thx @pigreco for the last revision tip....
I always forget the 'array_agg'.