[GIS] SQL / Select by Attributes query for “does not include text found in another specified field”

arcgis-10.2arcgis-desktopqueryselect-by-attributesql

I'm using ArcMap 10.2 and I'd like to write a query to select features where Field A does not include text found in Field B.

Specifically, Field A contains street numbers and street names. Field B contains only street names. I'd like to select features where Field A does not include the street names in Field B.

So far I've tried –

"Field_A" NOT LIKE'% "Field_B"%'

Best Answer

It looks like the syntax you are using above is for a File GDB. If this references a feature class in SQL Server, I believe the syntax would be something like this:

Field_A NOT LIKE '%' + Field_B + '%'

This should work in the select by attribute tool or you could also set this as a definition query on the layer and work with the results that way as well.

I believe string concatenation is handled differently in Oracle so I'm not sure about that syntax.

Related Question