<?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: update attribute table from another table based on a query in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414466#M32648</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not entirely sure what you want to achieve. I notice that the dictionary you create includes an additional field in the list of field, but for instance RESID is not being taken into account by the dictionary. If you need both attributes for each OID, you could create a list as value in the dictionary like this:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;dct &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_oid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_FIELD_NAME&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_RESID&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So each OID will have a list of [FIELD_NAME, RESID]. But you would have to do something with it in order to justify including it in the dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also notice that you are reading the FIELD_NAME in this line:&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;FIELD_NAME &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.. but you are not doing anything with it. You just overwrite the result if the OID is in the dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So perhaps a little more explanation on what you are trying to achieve would be necessary for me to understand your goal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Nov 2017 12:51:39 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2017-11-20T12:51:39Z</dc:date>
    <item>
      <title>update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414446#M32628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... env.workspace = "C:\\Data"&lt;BR /&gt;... print 'Processing...'&lt;BR /&gt;... fc = "Updated_subset.dbf"&lt;BR /&gt;... cursor = arcpy.da.SearchCursor(fc, ["OID"])&lt;BR /&gt;... for row in cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL_stat= "OID = "+ str(row[0])&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2 = "airports_old.dbf"&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor2 = arcpy.da.SearchCursor(fc, ["STATE"], SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cursor2:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdatedValue = row2[0]&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3 = arcpy.da.UpdateCursor(fc2, ["STATE"],SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row3 in cursor3:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row3[0] = UpdatedValue&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3.updateRow(row3)&lt;BR /&gt;... del row&lt;BR /&gt;... del cursor&lt;BR /&gt;... del row2&lt;BR /&gt;... del cursor2&lt;BR /&gt;... del row3&lt;BR /&gt;... del cursor3&lt;BR /&gt;... &lt;BR /&gt;... print "Done"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment the script below&amp;nbsp; the OID is coneverted to string&lt;/P&gt;&lt;P&gt;SQL_stat= "OID = "+ str(row[0])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I rewrite the SQL stat if the OID Field&amp;nbsp;is already a string, hence, don't need to convert to string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 08:55:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414446#M32628</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T08:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414447#M32629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;python parser... not sure about how sql handles them but print statements use \ as an literal escape character.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;row0 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'hello'&lt;/SPAN&gt;

sql &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;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"field"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row0&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;sql&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="string token"&gt;"field"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'hello'&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:47:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414447#M32629</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T18:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414448#M32630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so how do I add this script to the above one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:26:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414448#M32630</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T15:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414449#M32631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you replace/modify your SQL_stat = ... line&lt;/P&gt;&lt;P&gt;replace "field" with "OID" and row0 with row[0]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:34:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414449#M32631</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-11-16T15:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414450#M32632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;import arcpy&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... env.workspace = "C:\Users\L0505857\Data"&lt;BR /&gt;... print 'Processing...'&lt;BR /&gt;... fc = "Updated_subset.dbf"&lt;BR /&gt;... cursor = arcpy.da.SearchCursor(fc, ["OID"])&lt;BR /&gt;... for row in cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL_stat= '"{}" = \'{}\''.format("field", row0)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2 = "airports_old.dbf"&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor2 = arcpy.da.SearchCursor(fc, ["STATE"], SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cursor2:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdatedValue = row2[0]&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3 = arcpy.da.UpdateCursor(fc2, ["STATE"],SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row3 in cursor3:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row3[0] = UpdatedValue&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3.updateRow(row3)&lt;BR /&gt;... del row&lt;BR /&gt;... del cursor&lt;BR /&gt;... del row2&lt;BR /&gt;... del cursor2&lt;BR /&gt;... del row3&lt;BR /&gt;... del cursor3&lt;BR /&gt;... &lt;BR /&gt;... print "Done"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 15:57:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414450#M32632</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T15:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414451#M32633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Henry, it helps if you post you code using tips&amp;nbsp;&amp;nbsp;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=75ece207-9a50-4ffd-8c5e-182bd0b476f8&amp;amp;searchIndex=1"&gt;/blogs/dan_patterson/2016/08/14/script-formatting?sr=search&amp;amp;searchId=75ece207-9a50-4ffd-8c5e-182bd0b476f8&amp;amp;searchIndex=1&lt;/A&gt;‌&amp;nbsp;&lt;/P&gt;&lt;P&gt;This helps everyone to refer to the same line number, and also to see if the indentation is correct in your script.&amp;nbsp; You can edit your post and the above comment to replace the code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 16:02:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414451#M32633</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-11-16T16:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414452#M32634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;row[0]&amp;nbsp;&lt;/P&gt;&lt;P&gt;note the slicing, since the first, and only entry in the row object is the value for the oid field.&amp;nbsp; Things in python are 0 based when counting&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 16:07:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414452#M32634</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-11-16T16:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414453#M32635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;Table 1 with &amp;nbsp;fields -&amp;nbsp; Top, Base, Names, and State all have contents&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;Table&amp;nbsp;2 with &amp;nbsp;fields -&amp;nbsp;&amp;nbsp; similar contents Top, Base, Names, and State, but the state needs to be updated with the state content in table 1&lt;/P&gt;&lt;P&gt;A script to update state in&amp;nbsp; table 2 if Top, Base and Names Match with table 1&amp;nbsp;if no match do something&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not sure if&amp;nbsp; the sql statement above will help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 16:52:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414453#M32635</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T16:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414454#M32636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not sure what the script is doing, partly because of the format.&amp;nbsp; I was just trying to point out a possible solution to the question you posted in the last lines.&amp;nbsp; If the script is functioning as designed, could you provide a listing of some input data and an expected output as example&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 16:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414454#M32636</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-11-16T16:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414455#M32637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the script below&lt;/P&gt;&lt;P&gt;can my sql statement be&amp;nbsp; to update&amp;nbsp; State in fc2 = "airports_old.dbf" if Field 1 and Field 2 in ... fc = "Updated_subset.dbf" matches withField 1 and Field 2&amp;nbsp; in airports_old..dbf"&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... env.workspace = "C:\\Data"&lt;BR /&gt;... print 'Processing...'&lt;BR /&gt;... fc = "Updated_subset.dbf"&lt;BR /&gt;... cursor = arcpy.da.SearchCursor(fc, ["OID"])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;... for row in cursor:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL_stat= "OID = "+ str(row[0])&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc2 = "airports_old.dbf"&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor2 = arcpy.da.SearchCursor(fc, ["STATE"], SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cursor2:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdatedValue = row2[0]&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3 = arcpy.da.UpdateCursor(fc2, ["STATE"],SQL_stat)&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row3 in cursor3:&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row3[0] = UpdatedValue&lt;BR /&gt;...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor3.updateRow(row3)&lt;BR /&gt;... del row&lt;BR /&gt;... del cursor&lt;BR /&gt;... del row2&lt;BR /&gt;... del cursor2&lt;BR /&gt;... del row3&lt;BR /&gt;... del cursor3&lt;BR /&gt;...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2017 17:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414455#M32637</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-16T17:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414456#M32638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the code you posted it looks like you are trying to do something like this:&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
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; env
env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Data"&lt;/SPAN&gt;

tbl1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Updated_subset.dbf"&lt;/SPAN&gt;
tbl2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"airports_old.dbf"&lt;/SPAN&gt;

fld_oid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"OID"&lt;/SPAN&gt;
fld_state &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"STATE"&lt;/SPAN&gt;

dct &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_oid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_state&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_oid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_state&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; curs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; curs&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; state &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; oid &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; dct&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dct&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;oid&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&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;/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;However, it doesn't make much sense to me. The OID in both tables correspond and using the OID you want to update the State in tbl2 with the one in tbl1?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:47:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414456#M32638</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T18:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414457#M32639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Xander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I keep getting&amp;nbsp; runtime errors&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; &lt;SPAN style="color: #004da8;"&gt;import&lt;/SPAN&gt; arcpy&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN style="color: #004da8;"&gt;import&lt;/SPAN&gt; env&lt;/P&gt;&lt;P&gt;... env.workspace = r"C:\Users\L0505857\Data"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... tbl1 = "Updated_subset.dbf"&lt;/P&gt;&lt;P&gt;... tbl2 = "airports_old.dbf"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... fld_oid = "OID"&lt;/P&gt;&lt;P&gt;... fld_state = "state"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... dct = {r[0]: r[1] &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; r &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; arcpy.da.SearchCursor(tbl1, (fld_oid, fld_state))}&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;with&lt;/SPAN&gt; arcpy.da.UpdateCursor(tbl2, (fld_oid, fld_state)) as curs:&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;for&lt;/SPAN&gt; row &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; curs:&lt;/P&gt;&lt;P&gt;... oid = row[0]&lt;/P&gt;&lt;P&gt;... state = row[1]&lt;/P&gt;&lt;P&gt;... &lt;SPAN style="color: #004da8;"&gt;if&lt;/SPAN&gt; oid &lt;SPAN style="color: #004da8;"&gt;in&lt;/SPAN&gt; dct:&lt;/P&gt;&lt;P&gt;... row[1] = dct[oid]&lt;/P&gt;&lt;P&gt;... curs.updateRow(row)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Runtime error&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;File "&amp;lt;string&amp;gt;", line 11, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;File "&amp;lt;string&amp;gt;", line 11, in &amp;lt;dictcomp&amp;gt;&lt;/P&gt;&lt;P&gt;RuntimeError: A column was specified that does not exist.&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 11:08:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414457#M32639</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-20T11:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414458#M32640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This error indicates that either "OID" or "state" is not a field that you have in your table "Updated_subset.dbf". Can you check?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 11:35:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414458#M32640</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2017-11-20T11:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414459#M32641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The two tables have&amp;nbsp; state and OID RESID attributes&lt;/P&gt;&lt;P&gt;I want to use the state field &amp;nbsp;attributes in Updated-subset.dbf to update the state field &amp;nbsp;attribute in airport.dbf which is currently empty&lt;/P&gt;&lt;P&gt;I&amp;nbsp; want the update to occur if the OID&amp;nbsp; and the RESID in both tables match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I m still getting the same runtime error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 11:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414459#M32641</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-20T11:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414460#M32642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange. Can you run the snippet below and post back what it prints?&lt;/P&gt;&lt;P&gt;&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
tbl1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\L0505857\Data\Updated_subset.dbf"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fld &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:47:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414460#M32642</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T18:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414461#M32643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OID&lt;/P&gt;&lt;P&gt;OBJECTID&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;FIELD_NAME&lt;/P&gt;&lt;P&gt;KEY_WELL&lt;/P&gt;&lt;P&gt;WATER_DEPT&lt;/P&gt;&lt;P&gt;BASIN_NAME&lt;/P&gt;&lt;P&gt;TOT_RECOVE&lt;/P&gt;&lt;P&gt;HC_TYPE&lt;/P&gt;&lt;P&gt;OVP_bar&lt;/P&gt;&lt;P&gt;Res_Age&lt;/P&gt;&lt;P&gt;Formation&lt;/P&gt;&lt;P&gt;Lithology&lt;/P&gt;&lt;P&gt;RESID&lt;/P&gt;&lt;P&gt;Regional_s&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 12:14:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414461#M32643</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-20T12:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414462#M32644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Xander, I was looking at the wrong table.&lt;/P&gt;&lt;P&gt;Code works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 12:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414462#M32644</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-20T12:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414463#M32645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There you go, there is no "state" field in the table. This is what causes the error on line 11:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;dct &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; r&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; r &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl1&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fld_oid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fld_state&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On this line, a dictionary is used reading the state field, but if it doesn't exist, it will return an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You also mention a field called "RESID" that should be used in the code, but it is not referenced anywhere in the code. Do I understand it correctly that the field "RESID" from&amp;nbsp;&amp;nbsp;Updated_subset.dbf should match the field "OID" from&amp;nbsp;airports_old.dbf?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you also list the field from&amp;nbsp;table&amp;nbsp;&lt;SPAN&gt;airports_old.dbf with this snippet and post these:&lt;/SPAN&gt;&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
tbl2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\L0505857\Data\airports_old.dbf"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; fld &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tbl2&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; fld&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And please explain what field in which table needs to be updated by what information when which condition is met. In case a field should be added before the update, please indicate that too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:47:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414463#M32645</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T18:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414464#M32646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, great, then ignore&amp;nbsp;the additional questions I just posted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 12:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414464#M32646</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2017-11-20T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: update attribute table from another table based on a query</title>
      <link>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414465#M32647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I want to add another field RESID to the search cursor&lt;/P&gt;&lt;P&gt;I ' m stuck at dct&lt;/P&gt;&lt;P&gt;see below ......&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;BR /&gt;env.workspace = r"C:\Users\L0505857\Data"&lt;BR /&gt;tbl1 = "Updated_subset.dbf"&lt;BR /&gt;tbl2 = "airports_old.dbf"&lt;BR /&gt;fld_oid = "OID"&lt;BR /&gt;fld_FIELD_NAME = "FIELD_NAME"&lt;BR /&gt;fld_RESID = "RESID"&lt;BR /&gt;dct = {r[0]: r[1] for r in arcpy.da.SearchCursor(tbl1, (fld_oid, fld_FIELD_NAME,fld_RESID))}&lt;BR /&gt;with arcpy.da.UpdateCursor(tbl2, (fld_oid, fld_FIELD_NAME,fld_RESID)) as curs:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in curs:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oid = row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FIELD_NAME = row[1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if oid in dct:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = dct[oid]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curs.updateRow(row)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Nov 2017 12:37:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/update-attribute-table-from-another-table-based-on/m-p/414465#M32647</guid>
      <dc:creator>Henryobaseki</dc:creator>
      <dc:date>2017-11-20T12:37:36Z</dc:date>
    </item>
  </channel>
</rss>

