TableSelect_analysis<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="punctuation token">,</SPAN> out_table<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>where_clause<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>"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:
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb'</SPAN>
<SPAN class="comment token">#variables</SPAN>
intable <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb\ElectionResults_Nov2016"</SPAN>
outtable <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"\\gisfile\GISstaff\Jared\ModelBuilder\JaredTest.gdb\Results3"</SPAN>
where_clause <SPAN class="operator token">=</SPAN> <SPAN class="string token">"ContestTitle = 'BALLOTS CAST - TOTAL'"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>TableSelect_analysis<SPAN class="punctuation token">(</SPAN>intable<SPAN class="punctuation token">,</SPAN> outtable<SPAN class="punctuation token">,</SPAN> where_clause<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.