AnsweredAssumed Answered

Select Layer by Attribute issues

Question asked by SHines-esristaff Employee on Oct 23, 2017
Latest reply on Oct 24, 2017 by SHines-esristaff

Hi all,

I am trying to 1) Select by Attribute and 2) overwrite a feature class with selected features.  Below is the script that I'm trying as a start.. and am getting an error related to Select by Attribute.  Ultimately, need to select last 365 days of data (not Baker neighborhood) and overwrite a feature class.. on a daily basis.  Thank you in advance for any assistance!  Shelby

 

# Description: Extract features to a new feature class based on an attribute query
# Import system modules
import arcpy

# Make a layer from the feature class
arcpy.MakeFeatureLayer_management ("D:/pd/crimeD.gdb/dencrime", "crimelayer")

# Select all crimes that happened in Baker
arcpy.SelectLayerByAttribute_management ("crimelayer", "NEW_SELECTION", ' "NEIGHBORHOOD_ID" = baker ')
# Write the selected features to a new featureclass
arcpy.CopyFeatures_management("crimelayer", "Bakercrime")

Outcomes