AnsweredAssumed Answered

(arcpy) Multiple TableSelect_analysis?

Question asked by jpilbeam on Jan 19, 2018
Latest reply on Jan 29, 2018 by rvburton
TableSelect_analysis(in_table, out_table, {where_clause})

"Selects table records matching a Structured Query Language (SQL) expression and writes them to an output table."


Using this function I have this simple script:

import arcpy
from arcpy import env

env.workspace = r'\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb'

intable = r"\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb\ElectionResults_Nov2016"
outtable = r"\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb\Results3"
where_clause = "ContestTitle = 'BALLOTS CAST - TOTAL'"

arcpy.TableSelect_analysis(intable, outtable, where_clause)


It selects all records named 'BALLOTS CAST - TOTAL' from the 'ContestTitle' column of my 'ElectionResults_Nov2016' table and writes them in the newly created 'Results3' table. 'BALLOTS CAST - TOTAL' is only one of 58 separate table record names. How can I write all 58 to their own tables?


Thanks for any help.