<?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: Joining multiple geodatabase tables via inner join in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352061#M27616</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks, &lt;BR /&gt;&lt;BR /&gt;but my question was really about how to specify the table join. ive tried putting the tables in the input parameter, but it doesnt make sense anyway as you need to tell arcpy how they are related. &lt;BR /&gt;&lt;BR /&gt;ive also tried to put sql in the expression parameter but i dont think i got it right. &lt;BR /&gt;&lt;BR /&gt;ideally id be able to find an example of where this is already done.&lt;BR /&gt;&lt;BR /&gt;Thanks anyway.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Post up the section of code you are having an error with.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jan 2013 11:34:39 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2013-01-22T11:34:39Z</dc:date>
    <item>
      <title>Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352058#M27613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;could some one point me in the right direction on how to join multiple geodatabase tables via inner join.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i have 6 tables in my geodatabase. each shares a common key field, ill call it roadname and it is a text field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;each table has a different attribute about that road stored in another field in that table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i want to join all six tables together via an inner join, keeping the roadname field from the first table, and specifying which (one) of the fields in each of the other tables i want to have in the new table. (this is a piece of cake in sql, but im new to python) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i can do it with two tables - called rain and geol, as below in the extract of python script &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeQueryTable_management (["rain","geol"], "queryout","ADD_VIRTUAL_KEY_FIELD", "",&lt;/SPAN&gt;&lt;BR /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [["rain.roadname", 'Roadname'],["rain.mean_grid_code", 'Rainfall'],["geol.descriptio", 'geology']],&lt;/SPAN&gt;&lt;BR /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "rain.roadname = geol.roadname ")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but i cant see how to make an expression that joins all six tables at once on road name and selects the field desired from each of the tables. ive tried believe me. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lee&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS. normally id do it in model builder and export to script, but i cant get it to work there. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PPS. Arcgis 10.1&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 04:28:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352058#M27613</guid>
      <dc:creator>LeeStamm</dc:creator>
      <dc:date>2013-01-18T04:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352059#M27614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have not tried this myself, so this is just an observation.&amp;nbsp; But...&amp;nbsp; Did you attempt to add all of the tables into the in_table parameter?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.MakeQueryTable_management (["rain","geol",&lt;STRONG&gt;"tab3","tab4","tab5"&lt;/STRONG&gt;], &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(that's what appears to be allowable from the help reference)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006r000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000006r000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"...The name of the table or tables to be used in the query"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wish I had a difinitive answer for you -- hopefully someone will follow up soon.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 11:39:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352059#M27614</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-01-18T11:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352060#M27615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but my question was really about how to specify the table join. ive tried putting the tables in the input parameter, but it doesnt make sense anyway as you need to tell arcpy how they are related. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ive also tried to put sql in the expression parameter but i dont think i got it right. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ideally id be able to find an example of where this is already done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks anyway.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 19:12:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352060#M27615</guid>
      <dc:creator>LeeStamm</dc:creator>
      <dc:date>2013-01-20T19:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352061#M27616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks, &lt;BR /&gt;&lt;BR /&gt;but my question was really about how to specify the table join. ive tried putting the tables in the input parameter, but it doesnt make sense anyway as you need to tell arcpy how they are related. &lt;BR /&gt;&lt;BR /&gt;ive also tried to put sql in the expression parameter but i dont think i got it right. &lt;BR /&gt;&lt;BR /&gt;ideally id be able to find an example of where this is already done.&lt;BR /&gt;&lt;BR /&gt;Thanks anyway.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Post up the section of code you are having an error with.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 11:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352061#M27616</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-01-22T11:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352062#M27617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks, &lt;BR /&gt;&lt;BR /&gt;but my question was really about how to specify the table join. ive tried putting the tables in the input parameter, but it doesnt make sense anyway as you need to tell arcpy how they are related. &lt;BR /&gt;&lt;BR /&gt;ive also tried to put sql in the expression parameter but i dont think i got it right. &lt;BR /&gt;&lt;BR /&gt;ideally id be able to find an example of where this is already done.&lt;BR /&gt;&lt;BR /&gt;Thanks anyway.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would make a table view of the fields you want joined for each table then use add join for each of them, allowing you to specify an inner join. You can then copy out the table view with the joins to a permanent table. This should restrict the output to only the fields specified for each table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 13:38:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352062#M27617</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-01-22T13:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352063#M27618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Guys for your suggestions,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i worked around it by doing a JoinField_management (in_data, in_field, join_table, join_field, {fields})&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; several times. that worked fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ive also explored the method mzcoyle suggested. that could work too. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;however the neatest way would still be via the make query table management tool if i could work that out. i may try again at a later date.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Leestamm&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2013 03:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352063#M27618</guid>
      <dc:creator>LeeStamm</dc:creator>
      <dc:date>2013-01-30T03:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple geodatabase tables via inner join</title>
      <link>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352064#M27619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;just in case anyones interested, the solution to the problem is as follows&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i had several tables (table 1 to 3) which i wanted to combine into a combined table as per attached worksheet by joining on Roadname , a common field.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the solution- using arcpy.MakeQueryTable_management is as follows. This works no worries and ill use this for simple joins in future. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeQueryTable_management("aspect;elevation;rainfall","QueryTable","USE_KEY_FIELDS","#","aspect.Roadname #;aspect.Aspect #;elevation.Elevation #;rainfall.Rainfall #","rainfall.Roadname = elevation.Roadname and rainfall.Roadname = aspect.Roadname")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when i tried to join 7 tables each of about 14000 rows each, it took a long time to display the table and convert it to a table. - probably because of the memory usage of joining the 7 tables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 23:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/joining-multiple-geodatabase-tables-via-inner-join/m-p/352064#M27619</guid>
      <dc:creator>LeeStamm</dc:creator>
      <dc:date>2013-02-13T23:45:43Z</dc:date>
    </item>
  </channel>
</rss>

