Syntax for SQL Select

Discussion created by dprosser on Feb 8, 2012
Latest reply on Feb 8, 2012 by dprosser
Hi all,

This may be more of a geoprocessing question (?) but in my Python code I am trying to select 2 types of polygons from my shapefile: both 'summer' and 'resident' classed polygons within my "season" field. Can anyone see an obvious error with my syntax; the error must be related to my "OR" statement (it runs successfully when I am selecting only one season class). Thank you for your help.

# Process 1: BHGO Summer Range (Select)...
    print "Running Range SELECT - select breeding range from shapefile..."
    selectOutput = outWorkspace + shapefileName + "_br.shp"
    selectInput = inRange + shapefile
    gp.Select_analysis(selectInput, selectOutput, "season = 'summer' OR 'resident'")

Traceback (most recent call last):
File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 312, in RunScript
exec codeObject in __main__.__dict__
File "D:\GIS_Watf\Script1.py", line 70, in <module>
gp.Select_analysis(selectInput, selectOutput, "season = 'summer' OR 'resident'")
ExecuteError: ERROR 999999: Error executing function.
An invalid SQL statement was used.
An invalid SQL statement was used.
Failed to execute (Select).