I'm trying to write a simple SQL query that just isn't working. I have two fields in my file geodatabase layer (ArcGIS Pro 2.3) and I want to select the records that match my simple SQL query of:
written out to LEFT(Layer,3) = OWNERSHIP_NUMBER
But I get an error saying that "The SQL expression has invalid syntax".
I must be doing it wrong somewhere but I don't know where. These are both FIELDS and not RECORDS, so that likely makes a difference in how my syntax is supposed to be written.
Looking up this article: SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop
it says "
String functions can be used to format strings. For instance, the LEFT function would return a certain number of characters starting on the left of the string. In this example, the query would return all states starting with the letter A:
LEFT(STATE_NAME,1) = 'A'
"
So, it makes me think my syntax is mostly right since both of my fields are strings. Any advice on making my SQL query syntax work?
Solved! Go to Solution.
And the page referenced also says:
A Lot Has Changed Since SQL-92
And so it has.
Geeze, you're right! This is a great segment from that article:
The result of each of the following comparisons is therefore unknown:0
NULL = 1 NULL <> 1 NULL > 1 NULL = NULL
Nothing equals
null
. Not evennull
equalsnull
because eachnull
could be different.
Haha, oh null. What a conundrum