AnsweredAssumed Answered

Pass sql expression with arcpy

Question asked by CCweedcontrol on Apr 9, 2020
Latest reply on Apr 9, 2020 by vangelo-esristaff

I am try to select the polygons with the max area within parcels but i am having trouble passing the sql through arcpy.da.SearchCursor. How can i pass this sql through SearchCursor?


sql = Shape_Area in (select max(Shape_Area) from Bldg_FP1 group by PIN)


with arcpy.da.SearchCursor(fc2, ['SHAPE@']) as cursor:
     for row in cursor:
          arcpy.SelectLayerByAttribute_management(fc,"NEW_SELECTION", sql)