I'm trying to use SelectLayerByAttribute to find the last point added to a FC. I figured I could use the objectid field because it's serial. I wrote the following:
arcpy.SelectLayerByAttribute_management("controller", "NEW_SELECTION", """ "OBJECTID" = (SELECT MAX("OBJECTID") FROM controller) """)
following the notes on found here
However, I get the following error:
Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 6494, in SelectLayerByAttribute raise e ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
I'm using a Postgres geodatabase and I know all the db's require slightly different formatting requirements. This one I can't figure out though.