AnsweredAssumed Answered

Select by attribute based on whether one field is a substring of another field

Question asked by bonfire98a on Jun 13, 2016
Latest reply on Jun 14, 2016 by Dan_Patterson

I have been looking for a way to use the SelectLayerByAttribute function to select records in Python based on whether or not one field is a substring of another field.  For example, in the table view below, I would want to select the first three records because each of their sub_text strings is contained within the full_text string, or use a NOT version to select the fourth record.  I had tried using the LIKE statement (Sub_Text LIKE Full_Text) but functionally it works the same as an = statement and thus selects nothing.  So far I've found out how to compare a field to a fixed string within the query, or to see if a string is located at various character positions within the string, but that doesn't really help.