Hello,
What is the proper syntax for where_clause when I have multiple conditions?
This is what I got when I exported from my model builder:
arcpy.Select_analysis(in_features = Pipe_Table__WGS_PIPE_,
out_feature_class = WGS_PIPE,
where_clause = "PIPE_DIAMETER <= 20 And SYS_ZONE <> 0 And OWNER = 'WDD' And USE_TYPE IN ('DIST', 'TRUNK', 'LSLATERAL', 'MANIFOLD') ")
The above returns me an error.
However, if I just do one condition such as the following below, it works...
arcpy.Select_analysis(in_features = Pipe_Table__WGS_PIPE_,
out_feature_class = WGS_PIPE,
where_clause = "PIPE_DIAMETER <= 20" )
Can anyone please help? Thanks!
Solved! Go to Solution.
I guess 'And' is somehow correct , but I got failures without specifying a workspace first OR the full path to the source and destinations
arcpy.analysis.Select(r"C:\Git_Dan\npgeom\npgeom.gdb\Polygons",
r"C:\Git_Dan\npgeom\npGeo_1.gdb\x1",
"A0 = 'A' And A1 = 'a'")
'And' just looks plain wrong
SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop
"AREA" > 1500 AND "GARAGE" > 2
I guess 'And' is somehow correct , but I got failures without specifying a workspace first OR the full path to the source and destinations
arcpy.analysis.Select(r"C:\Git_Dan\npgeom\npgeom.gdb\Polygons",
r"C:\Git_Dan\npgeom\npGeo_1.gdb\x1",
"A0 = 'A' And A1 = 'a'")
Thank you! This works