enter image description hereI am attempting to execute a Select query in Select By Attributes where the return record set I'm looking for includes all records where the String value is greater than 7 characters long.
For ex., I have records in my table where the value in the "LeftCityCo" field is 2395187, and other records where the value in the "LeftCityCo" field is 2395934ANO. I'm seeking to obtain a Selection that includes all records with values in this field greater than 7 characters long.
I've tried using the Left function and attempted the following query but returned an error:
Select * From Streets Where "LeftCityCo" = Left( "LeftCityCo", 7 )enter image description here
2 Answers 2
I did not have my code syntactically correct for my Select By Attributes query box. Because I was using this ui, I needed to change my expression to suit file types such as shapefile, File GDB and so on. I was attempting to use SQL syntax and that was incorrect.
Below is the code expression that returned the result I was expecting:
CHAR_LENGTH( "LeftCityCo" )> 7
Open the Select by Attributes window for the appropriate table and use the following expression
len("LeftCityCo") > 7
Quotes around the fieldname were not required with my data set but yours may be enter image description here
-
I still get "An invalid SQL statement was used." when attempting that expression.J56– J562017年12月05日 19:43:13 +00:00Commented Dec 5, 2017 at 19:43
-
Can you show me exactly (picture) of the attribute table with that field showingNULL.Dude– NULL.Dude2017年12月05日 19:47:04 +00:00Commented Dec 5, 2017 at 19:47
-
How do I post a screen capture?J56– J562017年12月05日 19:54:38 +00:00Commented Dec 5, 2017 at 19:54
-
Edit your question to include the image. You can upload directly from your pcNULL.Dude– NULL.Dude2017年12月05日 19:55:31 +00:00Commented Dec 5, 2017 at 19:55
-
Explore related questions
See similar questions with these tags.
WHERE Length("LeftCityCo") > 7
CHAR_LENGTH("LeftCityCo") > 7