"GNR"
is a string column and I expect the filter expression "GNR"='.11'
to only return the feature with the value '0.11'
.
Why are the other features with values of '.110'
and '.1100'
included?
Is there something wrong with my query?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this community"GNR"
is a string column and I expect the filter expression "GNR"='.11'
to only return the feature with the value '0.11'
.
Why are the other features with values of '.110'
and '.1100'
included?
Is there something wrong with my query?
There is nothing wrong with your query.
=
is a comparison operator and it returns all the records which begins with your string
Use this instead:
"GNR" LIKE '.11'
When you compare alphabetic characters, use ILIKE
instead.
EDIT
In QGIS 2.0.1
or newer you can use regular expressions, also:
regexp_match("GNR", '^.11$')
where:
^
indicates the start of the string;$
indicates the end of the string."GNR" ~ '^.11$'
which is a regex match and will force a string.
– Nathan W
Jan 28 '14 at 23:34