<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How Perform A Select Using &amp;quot;OR&amp;quot;? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377987#M29812</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A more common approach to selecting items from a list is to use SQL IN rather than creating SQL OR statements.&amp;nbsp; &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" title="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;H3 id="toc-hId-1483378884"&gt;Comparison operators&lt;/H3&gt;&lt;P&gt;You use comparison operators to compare one expression to another.&lt;/P&gt;&lt;H4 class="" id="toc-hId--1265291582"&gt;&lt;/H4&gt;&lt;DIV class=""&gt;&lt;TABLE style="width: 739px; border-color: #000000;"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #ffffffff;"&gt;&lt;TH colspan="1" style="width: 80px;"&gt;Operator&lt;/TH&gt;&lt;TH colspan="1" style="width: 645px;"&gt;Description&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY class=""&gt;&lt;TR class=""&gt;&lt;TD colspan="1" rowspan="1" style="width: 80px;"&gt;&lt;P&gt;[NOT] IN&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="width: 645px;"&gt;&lt;P&gt;Selects a record if it has one of several strings or values in a field. When preceded by NOT, it selects a record if it doesn't have one of several strings or values in a field. For example, this expression searches for four different state names:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"STATE_NAME" IN ('Alabama', 'Alaska', 'California', 'Florida')&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can take a Python list of names/values you want to look for and convert it to a SQL IN list:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

Q1_list &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CHARLES HAYS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SMIT CLYDE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
fc1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"F:\ArcGIS_Pro_Projects\AIS\AIS_Data\AIS_Data.gdb\TEST_AIS_Data"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

expression2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name IN ('{}')"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"','"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;q1 &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; q1 &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; Q1_list&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
SelectResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountTotal &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SelectResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Of "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountTotal&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Records Selected"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:27:29 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-12-11T17:27:29Z</dc:date>
    <item>
      <title>How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377984#M29809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcGIS Pro 2.4.3, and just running this script through IDLE for ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having some difficulty getting a standard expression in Python to return what I need.&amp;nbsp; I have created a simple query to try and run...if I can get this to work then I will insert this into my main program with added functions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the script it only returns&amp;nbsp;16 records (i.e. records for only&amp;nbsp;for variable Q1_A).&amp;nbsp; I'm trying to get it to return 18 records (which would include Q1_B).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

Q1_A &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CHARLES HAYS"&lt;/SPAN&gt;
Q1_B &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SMIT CLYDE"&lt;/SPAN&gt;
fc1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"F:\ArcGIS_Pro_Projects\AIS\AIS_Data\AIS_Data.gdb\TEST_AIS_Data"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#expression1 = ("Vessel_Name = 'CHARLES HAYS' Or Vessel_Name = 'SMIT CLYDE'")&lt;/SPAN&gt;
expression1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Vessel_Name = '"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Q1_A&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"'"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name = '"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Q1_B&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
SelectResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountTotal &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SelectResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Of "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountTotal&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Records Selected"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hardcoding it (as per what is commented out) works exactly as I need it to work, and returns 18 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use an "and" instead of an "or" it returns 2 records (only for Q1_B).&amp;nbsp; Logic tells me that using an "or" it should select 18 records (i.e. for both Q1_A and Q1_B).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The print statement (e.g. print (expression1)) also only prints the variable Q1_A.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong here?&amp;nbsp; How do I get the variable "expression1" to read the entire string?&amp;nbsp; I know I'm missing something, but for the life of me I just can't see it...and I have been spinning my wheels on this all afternoon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;&lt;EM style="font-family: georgia, palatino, serif; "&gt;Thank you&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:27:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377984#M29809</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2021-12-11T17:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377985#M29810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't do query expressions, but I do formatting.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't over "str" things.&amp;nbsp; Use the mini-format capabilities of python.&amp;nbsp; For example.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Q1_A &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CHARLES HAYS"&lt;/SPAN&gt;
Q1_B &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SMIT CLYDE"&lt;/SPAN&gt;

expression1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name = '{}' or Vessel_Name = '{}'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Q1_A&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Q1_B&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

Vessel_Name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'CHARLES HAYS'&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;or&lt;/SPAN&gt; Vessel_Name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'SMIT CLYDE'&lt;/SPAN&gt;‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now you can mess around with it to get it to work like maybe it is OR instead of 'or'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:27:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377985#M29810</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T17:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377986#M29811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3116" target="_blank"&gt;Dan Patterson&lt;/A&gt;‌ offers a good suggestion for formatting your OR statement and should correct your issue.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;The print statement (e.g. print (expression1)) also only prints the variable Q1_A.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is because of the double quotes around the word " or ".&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;# wrong
expression1 = ("Vessel_Name = '" + str(Q1_A) + "'" or "Vessel_Name = '" + str(Q1_B) + "'")
# correct
expression1 = ("Vessel_Name = '" + str(Q1_A) + "' or Vessel_Name = '" + str(Q1_B) + "'")&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377986#M29811</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T17:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377987#M29812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A more common approach to selecting items from a list is to use SQL IN rather than creating SQL OR statements.&amp;nbsp; &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" title="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;H3 id="toc-hId-1483378884"&gt;Comparison operators&lt;/H3&gt;&lt;P&gt;You use comparison operators to compare one expression to another.&lt;/P&gt;&lt;H4 class="" id="toc-hId--1265291582"&gt;&lt;/H4&gt;&lt;DIV class=""&gt;&lt;TABLE style="width: 739px; border-color: #000000;"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #ffffffff;"&gt;&lt;TH colspan="1" style="width: 80px;"&gt;Operator&lt;/TH&gt;&lt;TH colspan="1" style="width: 645px;"&gt;Description&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY class=""&gt;&lt;TR class=""&gt;&lt;TD colspan="1" rowspan="1" style="width: 80px;"&gt;&lt;P&gt;[NOT] IN&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="1" rowspan="1" style="width: 645px;"&gt;&lt;P&gt;Selects a record if it has one of several strings or values in a field. When preceded by NOT, it selects a record if it doesn't have one of several strings or values in a field. For example, this expression searches for four different state names:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"STATE_NAME" IN ('Alabama', 'Alaska', 'California', 'Florida')&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can take a Python list of names/values you want to look for and convert it to a SQL IN list:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

Q1_list &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CHARLES HAYS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SMIT CLYDE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
fc1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"F:\ArcGIS_Pro_Projects\AIS\AIS_Data\AIS_Data.gdb\TEST_AIS_Data"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

expression2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name IN ('{}')"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"','"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;q1 &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; q1 &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; Q1_list&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
SelectResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;expression2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountTotal &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
CountResult &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SelectResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountResult&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Of "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CountTotal&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" Records Selected"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:27:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377987#M29812</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T17:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377988#M29813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;but the field name isn't quoted if that is needed for the query in either case&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Q1_list &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CHARLES HAYS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SMIT CLYDE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

expr0 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name IN {}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tuple&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Q1_list&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Vessel_Name IN ('CHARLES HAYS', 'SMIT CLYDE')"&lt;/SPAN&gt;

expr1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Vessel_Name IN ('{}')"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"','"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;q1 &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; q1 &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; Q1_list&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"Vessel_Name IN ('CHARLES HAYS','SMIT CLYDE')"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- tuple or join, &lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:27:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377988#M29813</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T17:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377989#M29814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Although &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/addfielddelimiters.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/addfielddelimiters.htm"&gt;AddFieldDelimiters—ArcPy Functions | ArcGIS Desktop&lt;/A&gt; will still add double quotes around file geodatabase and shape file field names, they haven't been necessary for a while.&amp;nbsp; The ArcMap &lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/sql-reference-for-query-expressions-used-in-arcgis.htm" title="https://desktop.arcgis.com/en/arcmap/10.3/map/working-with-layers/sql-reference-for-query-expressions-used-in-arcgis.htm"&gt;SQL reference for query expressions used in ArcGIS—Help | ArcGIS for Desktop (ArcMap)&lt;/A&gt; documentation states:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;For File geodatabase data you can enclose your field names in double quotes, but it's generally not needed.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The ArcGIS Pro &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm" title="https://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm"&gt;SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop (Pro)&lt;/A&gt; documentation has gone one step further and completely removed the Fields section so there are no references to field delimiters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 16:15:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377989#M29814</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-20T16:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377990#M29815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can tell how often I do queries &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 17:20:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377990#M29815</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-20T17:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377991#M29816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To your defense, Esri handled the change in a very passive way over a period of time, and they didn't clean up all their documentation completely.&amp;nbsp; The Add Field Delimiters tool still states that file geodatabase and shape files use double quotes. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 18:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377991#M29816</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-20T18:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377992#M29817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for such awesome (and timely) advice.&amp;nbsp; I got my script to work, so I'm glad I posted the question.&amp;nbsp; I have only just recently returned to Python scripting so I'm in the process of relearning the syntax.&amp;nbsp; Obviously I need to learn a few things...even simple things, like the difference between single and double quotes, the combinations of these, and when to use them.&amp;nbsp; A couple of these responses have also opened up other options and approaches to solving the same problem...something of which I really appreciate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to put all of these responses into my "How 2" folder for future reference for sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm scheduled to take the first ESRI Python course in February,&amp;nbsp; on the 20th, with plans to take the more advanced course in probably June if possible.&amp;nbsp; I might as well really sink my teeth into this as the benefits are HUGE when it comes to geoprocessing for sure (and much more).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I delved into arcpy in August-September as I needed to write a script that would automate a process from FME data conversion to Portal for ArcGIS publishing.&amp;nbsp; I got it to work entirely in December, but then I ran into problems.&amp;nbsp; The file geodatabase to which FME adds the converted AIS data has grown to be very cumbersome...it is now over 100-million points and I have only completed data from January to August (the plan is to convert data for each year).&amp;nbsp; However, before it's uploaded to Portal I filter it using the MOD option to select 1 in 10 records...so the final file size is much more manageable (I'm thinking that I should perhaps get FME to do this before it adds to the GDB too).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm planning to do is every 4 months (using the Select script you helped me fix) select the previous 3 months of AIS data and then dump those records into a Q1, Q2 etc. file geodatabase, which will keep the main file geodatabase at a much more management size.&amp;nbsp; With over 100-million points my script currently takes over 40 hours to run, but it's only 3-4 hours if it's 3-4 months worth of data (the script will just run after midnight on the first of each month).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The final data in Portal is then used to create heat maps where our Operations Department can then analyze to see where ship traffic is mostly concentrated in and around our harbor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #800080; font-family: georgia, palatino, serif; "&gt;Thank you very much again&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 18:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377992#M29817</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2020-01-20T18:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377993#M29818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark, please mark one of the responses as Correct to close out the question.&amp;nbsp; If multiple responses helped, picked the one that helped the most (or was the first) as Correct and mark the others helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 18:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377993#M29818</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-20T18:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377994#M29819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'arial black', sans-serif; color: #008000;"&gt;Joshua:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It just so happens I was trying (unsuccessfully) to do a query very similar to this but of course much less complex LOL.&amp;nbsp; I just ran into issues when trying to use a value in a variable with the "LIKE" operator.&amp;nbsp; I'm definitely going to experiment with this one as this seems to be something that would work in my case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to be able to select multiple records based on a DateTime extracted from the original data using FME.&amp;nbsp; The DateTime data looks something like, "20190401091323", with the last 8 characters pertaining to hours, minutes and seconds etc.&amp;nbsp; However, I only needed to select by year and month (the first 6 characters) but to be able to single out those records after each conversion, and using "LIKE" with a variable, apparently, is not supported.&amp;nbsp; So the only way I managed to do this (with my limited Python knowledge) was using a new field that&amp;nbsp;I had already created for that feature class (DateTime_2) that was only YearMonth, which would be NULL after each conversion (as the previous month's records would have had that already added)...so all records = NULL sufficed to calculate that field to YearMonth.&amp;nbsp; But I also don't like querying that way either.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your method here seems to be a much better way to approach this...so I will definitely revisit my code and rewrite it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&lt;EM style="font-family: georgia, palatino, serif; "&gt;Thanks.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 19:43:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377994#M29819</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2020-01-20T19:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377995#M29820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'arial black', sans-serif; color: #008000;"&gt;Randy:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I liked this solution as it's so very close to what I already had.&amp;nbsp; I can see I need to definitely work on my double and single quotes...I always seem to have difficulty with those :-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&lt;EM style="font-family: georgia, palatino, serif; "&gt;Thanks again&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 19:45:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377995#M29820</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2020-01-20T19:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377996#M29821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'arial black', sans-serif; color: #008000;"&gt;Dan:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for this.&amp;nbsp; I will most definitely experiment with this code...all of the suggestions here actually.&amp;nbsp; I still have a bit to learn about arcpy I see :-).&amp;nbsp; I will spend some time learning more about braces "{ }" too...I wasn't aware of this method but I can certainly see how it would be a powerful tool.&amp;nbsp; It will probably take me a few months, but by the end of 2020 I expect to be a LOT more fluent in Python for ArcGIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800080;"&gt;&lt;EM style="font-family: georgia, palatino, serif; "&gt;Thanks again.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 19:49:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377996#M29821</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2020-01-20T19:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377997#M29822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'arial black', sans-serif; color: #008000;"&gt;Done.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 19:50:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377997#M29822</guid>
      <dc:creator>Mark_Hotz</dc:creator>
      <dc:date>2020-01-20T19:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: How Perform A Select Using "OR"?</title>
      <link>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377998#M29823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LIKE is supported in SQL queries in ArcGIS.&amp;nbsp; Start a different thread and explain what you tried and what isn't working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2020 20:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-perform-a-select-using-quot-or-quot/m-p/377998#M29823</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-20T20:32:21Z</dc:date>
    </item>
  </channel>
</rss>

