Query for left 5 characters of one field <> left 5 of another

1245
2
05-06-2019 08:38 AM
KennieHarris
New Contributor II

Any ideas? I'm using Pro and working in a file gdb.

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

I would just be easier to create a temporary field

Python.. parser in the field calculator going into a text field

!FirstField![:5] + !SecondField![:5]

then query that field and do what you need with the results.

Or build a query using a logical and

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

File geodatabases support limited string functions:  SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop .  Using Select By Attribute tool,

SUBSTRING(Field1 FROM 1 FOR 5) <> SUBSTRING(Field2 FROM 1 FOR 5)‍‍