I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message “An invalid SQL statement was used”.
whereclause = """"X" BETWEEN {0} AND {1}""".format(
min(X)[0]-1000,
max(X)[0]+1000)
ap.FeatureClassToFeatureClass_conversion(SamledeMaalinger,ap.env.workspace,"SamledeMaalingerSort", whereclause)
The whereclause returns “X” BETWEEN 555157.0723 AND 557157.0723 so it’s not the string that’s the issue.
The SQL-query works if I use < and > instead, but the BETWEEN for some reason doesn’t.
So what’s the issue? Do the SQL-queries in arcpy have limitations?