<?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>idea One-to-first join — Control what related record gets used in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idi-p/1237557</link>
    <description>&lt;P&gt;It would be helpful if we could control the logic used for getting the records on the &lt;EM&gt;many&lt;/EM&gt; side of [one-to-first] joins.&lt;/P&gt;&lt;P&gt;For example, choose an ORDER BY field: Grab the related record with the &lt;STRONG&gt;latest date&lt;/STRONG&gt;, or the largest integer, etc. Specify ascending or descending order.&lt;/P&gt;&lt;P&gt;Even better, make it a user-defined ORDER BY &lt;STRONG&gt;sql clause&lt;/STRONG&gt;, so that we can use specialized logic like:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SQL CASE statement&lt;/LI&gt;&lt;LI&gt;Multiple sorting fields, some ASC and some DESC&lt;/LI&gt;&lt;LI&gt;NULLS FIRST or NULLS LAST (relatively unknown SQL functionality)&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/specify-how-nulls-are-sorted-in-the-attribute/idi-p/1184709" target="_self"&gt;Specify how nulls are sorted in the attribute table (nulls first or last)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Related:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/choose-if-join-will-be-1-1-or-1-many/idi-p/1239915" target="_self"&gt;Choose if join will be 1:1 or 1:Many&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2024 14:38:42 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-09-04T14:38:42Z</dc:date>
    <item>
      <title>One-to-first join — Control what related record gets used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idi-p/1237557</link>
      <description>&lt;P&gt;It would be helpful if we could control the logic used for getting the records on the &lt;EM&gt;many&lt;/EM&gt; side of [one-to-first] joins.&lt;/P&gt;&lt;P&gt;For example, choose an ORDER BY field: Grab the related record with the &lt;STRONG&gt;latest date&lt;/STRONG&gt;, or the largest integer, etc. Specify ascending or descending order.&lt;/P&gt;&lt;P&gt;Even better, make it a user-defined ORDER BY &lt;STRONG&gt;sql clause&lt;/STRONG&gt;, so that we can use specialized logic like:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;SQL CASE statement&lt;/LI&gt;&lt;LI&gt;Multiple sorting fields, some ASC and some DESC&lt;/LI&gt;&lt;LI&gt;NULLS FIRST or NULLS LAST (relatively unknown SQL functionality)&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/specify-how-nulls-are-sorted-in-the-attribute/idi-p/1184709" target="_self"&gt;Specify how nulls are sorted in the attribute table (nulls first or last)&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Related:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/choose-if-join-will-be-1-1-or-1-many/idi-p/1239915" target="_self"&gt;Choose if join will be 1:1 or 1:Many&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 14:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idi-p/1237557</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-09-04T14:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237873#M22388</link>
      <description>&lt;P&gt;I can get behind this.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 17:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237873#M22388</guid>
      <dc:creator>JeffWard</dc:creator>
      <dc:date>2022-12-05T17:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237898#M22390</link>
      <description>&lt;P&gt;I feel like I've ran into other use cases via geoprocessing tools, python scripts, etc. where a functionality along these lines could be very useful. It's sometimes difficult to find documentation or troubleshoot what ESRI is actually utilizing to iterate over a collection of objects. You would think it'd be OBJECTID, but I feel like I've ran into situations where that didn't appear to be the case. Even if it were OBJECTID, that doesn't provide a ton of user-ability to control the iteration process.&lt;/P&gt;&lt;P&gt;I like the idea of a user defined clause, and I think that would be preferred as it could be integrated into automation. However, even a general radio button that would specify that a join, geoprocess, ArcPy function, etc. honors how a table or feature class is currently ordered would be a useful upgrade.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:06:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237898#M22390</guid>
      <dc:creator>ScottFedak2085</dc:creator>
      <dc:date>2022-12-05T18:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237918#M22393</link>
      <description>&lt;P&gt;Very glad to see this idea come up here!&lt;BR /&gt;Currently in 3.1 we have added this ability for the Join Field tool.&amp;nbsp; The same matching code is used for Add Join.&lt;BR /&gt;&lt;BR /&gt;We are considering/tracking this with a support issue for Add join to allow one to first joining.&lt;BR /&gt;&lt;BR /&gt;We can easily implement a one-to-first joining that will use ObjectId to do the joining and require that both data be within the same workspace (on our &lt;EM&gt;near term&lt;/EM&gt; radar).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If there are enough upvotes and comments we &lt;EM&gt;may&lt;/EM&gt; be able to get development time for adding the custom control to expose&amp;nbsp;OrderBy clause as a control.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 18:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1237918#M22393</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2022-12-05T18:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1238691#M22429</link>
      <description>&lt;P&gt;Related:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/manually-specify-join-clause-using-sql/idc-p/1238685/highlight/true#M22428" target="_self"&gt;User-defined SQL join clause&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/gp-tool-to-select-greatest-n-per-group/m-p/1238363" target="_blank" rel="noopener"&gt;GP tool to select greatest n per group&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/446891/file-geodatabase-sql-expression-to-get-greatest-n-per-group" target="_blank" rel="nofollow noopener noreferrer"&gt;File Geodatabase SQL expression to get greatest n per group&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;[ERROR 000358: Invalid expression]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/support-correlated-subqueries-in-file-geodatabase/idi-p/1238551/jump-to/first-unread-message" target="_self"&gt;Support correlated subqueries in file geodatabase SQL expressions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/74735554/select-greatest-n-per-group-using-exists" target="_self"&gt;Select greatest n per group using EXISTS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/geodatabase-questions/what-sql-standard-to-use-when-writing-geodatabase/m-p/1239566" target="_self"&gt;What SQL standard to use when writing geodatabase-agnostic SQL expressions?&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 04:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1238691#M22429</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-12-15T04:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1239993#M22488</link>
      <description>&lt;P&gt;Here's a workaround for enterprise geodatabases and mobile geodatabases (not file geodatabases). It also works for Excel files since &lt;A href="https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-uses-the-sqlite-sql-dialect-for/m-p/1366853#M77009" target="_self"&gt;ArcGIS uses &lt;STRONG&gt;SQLite SQL&lt;/STRONG&gt; for Excel file SQL expressions&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Create a definition query on the join table -- to pare down the rows so that there's only one row for each ID. Examples:&lt;/P&gt;&lt;P&gt;Oracle (FETCH):&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;roadinsptable.&lt;/FONT&gt;&lt;/STRONG&gt;objectid IN (
     SELECT objectid
       FROM roadinsptable r2
      WHERE r2.asset_id = roadinsptable.asset_id
&lt;FONT color="#0000FF"&gt;   ORDER BY date_ DESC, condition DESC
      FETCH FIRST ROW ONLY&lt;/FONT&gt;
            )&lt;/PRE&gt;&lt;P&gt;SQLite/mobile geodatabase and Excel files (LIMIT):&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;roadinsptable.&lt;/FONT&gt;&lt;/STRONG&gt;objectid IN (
     SELECT objectid
       FROM roadinsptable r2
      WHERE r2.asset_id = roadinsptable.asset_id
&lt;FONT color="#0000FF"&gt;   ORDER BY date_ DESC, condition DESC
      LIMIT 1&lt;/FONT&gt;
            )&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;&lt;FONT color="#000000"&gt;&lt;EM&gt;(likely works for other databases too)&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#999999"&gt;Those queries only return one row per ASSET_ID (the field I'll be joining on). If there is a tie, then it uses a different field, CONDITION, to break the tie. &lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#999999"&gt;Additional tie-breaker fields can be easily added to the ORDER BY clause. &lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#999999"&gt;For other use cases, LIMIT 1 (or FETCH) could be changed so that it returns multiple rows per ASSET_ID, not just one row, if required. &lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#999999"&gt;More info here:&lt;/FONT&gt; &lt;A href="https://stackoverflow.com/questions/74756261/using-a-where-clause-subquery-select-the-greatest-n-per-group-with-a-tie-breake" target="_self"&gt;Using a WHERE clause subquery, select the greatest n per group with a tie-breaker&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;Next, join to the table that has the definition query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Result:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;That lets us control what related record is used in the join. The join is now 1:1 instead of one-to-first or 1:M.&lt;/P&gt;&lt;P&gt;So that satisfies the original problem, but only for datatypes that have full SQL support. So it doesn't help us for file geodatabases or other datatypes that don't support &lt;U&gt;&lt;EM&gt;correlated&lt;/EM&gt;&lt;/U&gt; subqueries in SQL expressions. More info:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/support-correlated-subqueries-in-file-geodatabase/idi-p/1238551/jump-to/first-unread-message" target="_self"&gt;Support correlated subqueries in file geodatabase SQL expressions&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;On closer inspection, there's a problem with this approach (ArcGIS Pro 3.0.3; mobile geodatabase).&lt;/P&gt;&lt;P&gt;When I try to create the join on the table with the definition query, I get an error:&lt;/P&gt;&lt;PRE&gt;Failed to refresh table. &lt;BR /&gt;Error: &lt;BR /&gt;Underlying DBMS error [ambiguous column name:&lt;BR /&gt;objectid] [Roads][STATE_ID = 0]&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1670784209383.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58246iE32CF647C83914FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1670784209383.png" alt="Bud_0-1670784209383.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried adding prefixes to all fields in the subquery, but that had no effect on the error:&lt;/P&gt;&lt;PRE&gt;objectid IN (
     SELECT &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;r2.&lt;/FONT&gt;&lt;/STRONG&gt;objectid
       FROM roadinsptable r2
      WHERE r2.asset_id = roadinsptable.asset_id
   ORDER BY &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;r2.&lt;/FONT&gt;&lt;/STRONG&gt;date_ DESC, &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;r2.&lt;/FONT&gt;&lt;/STRONG&gt;condition DESC
      LIMIT 1
            )&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I'm not sure what the cause is.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have the same problem in an Oracle 18c 10.7.1 enterprise gdb (ArcGIS Pro 2.6.8):&lt;/P&gt;&lt;PRE&gt;Failed to refresh table.&lt;BR /&gt;Error:&lt;BR /&gt;Underlying DBMS error [ORA-00918: column&lt;BR /&gt;ambiguously defined] [DBJoin1]&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1670784956234.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58247iF0F200AE3722CE4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1670784956234.png" alt="Bud_0-1670784956234.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solved:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I had to add a table prefix (aka "fully qualify the table name") for the objectid in the first line:&lt;/P&gt;&lt;P&gt;Before:&lt;/P&gt;&lt;PRE&gt; objectid IN (&lt;/PRE&gt;&lt;P&gt;After:&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt; roadinsptable.&lt;/FONT&gt;&lt;/STRONG&gt;objectid IN (&lt;/PRE&gt;&lt;P&gt;I've updated the original queries.&lt;/P&gt;&lt;P&gt;Idea:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/join-to-table-with-definition-query-column-name/idi-p/1240170" target="_self"&gt;Join to table with definition query — column name should get prefixed (SQL expression with subquery)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BUG-000155819: Attribute table of joined layer in Mobile Geodatabase does not open when a definition query with a subquery is applied to the join table.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 07:24:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1239993#M22488</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-06T07:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1270342#M23889</link>
      <description>&lt;P&gt;I would love to see this as well, specifically the &lt;EM&gt;one-to-first&lt;/EM&gt; for the &lt;STRONG&gt;latest date&lt;/STRONG&gt;, as you said.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 13:03:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1270342#M23889</guid>
      <dc:creator>BenCunningham</dc:creator>
      <dc:date>2023-03-22T13:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279286#M24494</link>
      <description>&lt;P&gt;I just found out that you can do this in ArcGIS Online join tool.&amp;nbsp; I thought I must have been missing something in Arc Pro all this time, but apparently not!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been wishing we had this ability for years.&amp;nbsp; Can't believe it made it to AGOL before Pro!&lt;/P&gt;&lt;P&gt;My work around now is to create a hosted live Join View layer from join tool in map viewer classic, grabbing the most recent record from the join table using ObjectID descending order.&amp;nbsp; This gives me a live layer that I can symbolize from an attribute in my join table (from most recently created record).&lt;/P&gt;&lt;P&gt;I still have a need to get this attribute into my parent table, so now in Arc Pro I join the new live join layer from AGOL back to my parent layer/table and use field calculator to populate that most recent value back into my parent table.&lt;/P&gt;&lt;P&gt;Crazy round-about solution.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 16:08:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279286#M24494</guid>
      <dc:creator>BrantCarman</dc:creator>
      <dc:date>2023-04-17T16:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279340#M24497</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/133959"&gt;@BrantCarman&lt;/a&gt;&amp;nbsp;Interesting. Yes, it's weird that you can do it in ArcGIS Online, but not ArcGIS Pro (at least not out of the box).&lt;/P&gt;&lt;P&gt;Out of curiosity, is there a reason why the definition query workaround I mentioned above wouldn't work for you?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;SQLite/mobile geodatabase (likely works for other databases too):&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;roadinsptable.&lt;/FONT&gt;&lt;/STRONG&gt;objectid IN (
     SELECT objectid
       FROM roadinsptable r2
      WHERE r2.asset_id = roadinsptable.asset_id
&lt;FONT color="#0000FF"&gt;   ORDER BY date_ DESC, condition DESC
      LIMIT 1&lt;/FONT&gt;
            )&lt;/PRE&gt;&lt;P&gt;I thought that was kind of a neat solution. But it doesn't work for file geodatabases, since they don't have full SQL support.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 17:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279340#M24497</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-04-17T17:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279353#M24498</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;good question.&amp;nbsp; I'm working with Hosted Feature Layers primarily and plugging the layers into a Python script to automate some field calculations between join and input table.&amp;nbsp; I didn't even think to try your definition query.&amp;nbsp; Any experience trying it with AGOL hosted Feature Layers? Or with setting the definition in a python script?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 17:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279353#M24498</guid>
      <dc:creator>BrantCarman</dc:creator>
      <dc:date>2023-04-17T17:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279394#M24502</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/133959"&gt;@BrantCarman&lt;/a&gt;&amp;nbsp;been working on this in 3.2 the definition queries transfering and updating is mostly correct/better than ArcMap.&amp;nbsp; Maybe my testing script below can be helpful to you in trying this approach.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = arcpy.management.MakeFeatureLayer('country_geom', "lyr_with_def_query")[0]
lyr.updateDefinitionQueries([{'name': 'fc_query', 'sql': "country_geom.ISO_3DIGIT LIKE 'A%'", 'isActive': True}])
tab = arcpy.management.MakeTableView('country_tab', "tab_with_def_query", "ISO_3DIGIT LIKE '%B%'")[0]
tab.updateDefinitionQueries([{'name': 'tab_query', 'sql': "country_geom.ISO_3DIGIT LIKE '%B%'", 'isActive': True}]) #put your own subquery code here
result_with_and_2_def_query = arcpy.management.AddJoin(lyr, 'ISO_3DIGIT', tab, 'ISO_3DIGIT')[0]
dfqs = result_with_and_2_def_query.listDefinitionQueries()
print(dfqs)
result_less_join = arcpy.management.RemoveJoin(result_with_and_2_def_query)[0]
dfqs_remove = result_less_join.listDefinitionQueries() #Check to ensure that it is removed properly
print(dfqs_remove)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One TODO (Not fixed yet):&lt;BR /&gt;SubQueries still require manual intervention:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/join-to-table-with-definition-query-column-name/idi-p/1240170" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-pro-ideas/join-to-table-with-definition-query-column-name/idi-p/1240170&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 19:12:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279394#M24502</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2023-04-17T19:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279453#M24507</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/133959"&gt;@BrantCarman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;I didn't even think to try your definition query. Any experience trying it with AGOL hosted Feature Layers? Or with setting the definition in a python script?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Sorry, no experience with either.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; What kind of database is AGOL behind the scenes? PostgreSQL? If so, then the SQLite definition query I mentioned might work, since PostgreSQL seems to support the LIMIT clause, just like SQLite.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 21:58:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279453#M24507</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-04-17T21:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279812#M24522</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/342593"&gt;@JonathanNeal&lt;/a&gt;&amp;nbsp;I'll make a note to try this out, but unfortunatley entering the "busy season" and not much time to R&amp;amp;D on this project.&lt;/P&gt;&lt;P&gt;My hope is that this idea gets some more traction and ESRI implements sooner rather than later, because it's a great idea and would be an awesome functionality in ArcGIS Pro!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 17:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1279812#M24522</guid>
      <dc:creator>BrantCarman</dc:creator>
      <dc:date>2023-04-18T17:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1280164#M24541</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/133959"&gt;@BrantCarman&lt;/a&gt;&amp;nbsp;Does this help you at all?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-questions/use-a-sql-expression-inside-a-python-or-arcade/m-p/1280151/highlight/true#M67458" target="_self"&gt;&lt;SPAN&gt;Use a SQL expression inside a Python or Arcade field calculation?&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Interestingly, SQL&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;is&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;an option when using the field calculator on a hosted feature service.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I don't use hosted feature services (is that the same thing as AGOL?), so I don't know if it applies or not. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, could you do a SQL field calculation in ArcGIS Online, and use some SQL logic like I mentioned above to &lt;EM&gt;"grab the most recent record from the join table using ObjectID descending order"&lt;/EM&gt;?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2023 13:42:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1280164#M24541</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-04-19T13:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297650#M25349</link>
      <description>&lt;P&gt;FYI, another option that is supported on file geodatabases are views:&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-database-view.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-database-view.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297650#M25349</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2023-06-09T16:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: One-to-first joins: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297695#M25353</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/342593"&gt;@JonathanNeal&lt;/a&gt;&amp;nbsp;I couldn't find a way to "control what related record is used" (such as get the latest inspection for each road) when using a FGDB database view, since FGDB SQL doesn't support&amp;nbsp;&lt;EM&gt;correlated subqueries&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:53:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297695#M25353</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2023-06-09T17:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Join: Control what related record is used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297737#M25356</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;I group by the join Id and used an aggregate to choose my values of interest.&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;Select Name, max(Desc) as myD from JoinTable group by Name&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 20:14:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1297737#M25356</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2023-06-09T20:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Join — Control what related record gets used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369204#M27981</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/342593"&gt;@JonathanNeal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a classic FGDB use case in this post:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/selecting-the-most-recent-records-based-on-unique/td-p/1365493" target="_self"&gt;Selecting the most recent records based on unique values in another field&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I tried using your "group by in a database view" technique:&lt;/P&gt;&lt;PRE&gt;--My FGDB table is called: &lt;EM&gt;species_records&lt;/EM&gt;.&lt;BR /&gt;--The FGDB view below will be called: &lt;EM&gt;latest_vw&lt;/EM&gt;.&lt;BR /&gt;&lt;BR /&gt;select
    t_species as v_species,
    max(t_date) as v_date
from
    species_records
group by
    t_species&lt;/PRE&gt;&lt;P&gt;The requirement is: Select the latest record for each species group. &lt;STRONG&gt;Include all fields from the original table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When it comes to your group by/view technique, I don't know how to bring all the other fields into the query. In other words, I don't know how to link the original table to the group by view.&lt;/P&gt;&lt;P&gt;I've tried a number of different SQL techniques (see&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/joins-based-on-multiple-fields/idi-p/947155" target="_self"&gt;Joins based on multiple fields&lt;/A&gt;) and also a "view on a view" that work in a mobile geodatabase but don't work in a file geodatabase, due to various FGDB SQL bugs.&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 01:18:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369204#M27981</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-15T01:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Join — Control what related record gets used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369333#M27985</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp; (&lt;STRONG&gt;Untested&lt;/STRONG&gt;) I didn't get to trying it yet but put comments on what I am hoping will happen.&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/manage-file-gdb/sql-reporting-and-anlysis-file-geodatabases.htm" target="_blank"&gt;SQL for reporting and analysis on file geodatabases—ArcGIS Pro | Documentation&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;--My FGDB table is called: species_records.
--The FGDB view below will be called: latest_vw.

select
    t_species as v_species,
    SUBSTRING(max(CONCAT(EXTRACT(YEAR FROM t_date), EXTRACT(MONTH FROM t_date), EXTRACT(DAY FROM t_date), OBJECTID)), 10, 10) as LastUpdatedOID 
    -- Cast date as text in the format YYYYMMDD
    -- Get Field of interest, OBJECTID in our case
    -- Skip the first 10 characters
from
    species_records
group by
    t_species&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 01:11:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369333#M27985</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2024-01-12T01:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Join — Control what related record gets used</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369987#M28023</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/342593"&gt;@JonathanNeal&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I came up with. It's a FGDB database view.&lt;/P&gt;&lt;P&gt;Select the greatest 1 per group, with ties:&lt;/P&gt;&lt;PRE&gt;select
    *
from
    species_records
inner join
    (select
        t_species,
        max(t_date) as t_date 
    from
        species_records 
    group by
        t_species) l
    on species_records.t_species = l.t_species 
       and species_records.t_date = l.t_date&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or, select 1 per group, without ties:&lt;/P&gt;&lt;PRE&gt;select
    *
from
    species_records s
inner join
    (
    select
        min(objectid) as objectid,
        min(t_unique_id) as t_unique_id,
        t_species,
        max(t_date) as t_date
    from
        (select
            *
        from
            species_records
        inner join
            (select
                t_species,
                max(t_date) as t_date 
            from
                species_records 
            group by
                t_species) l
            on species_records.t_species = l.t_species 
               and species_records.t_date = l.t_date
        )
    group by
        t_species
    ) l
    on s.t_unique_id = l.t_unique_id&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Source:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/selecting-the-most-recent-records-based-on-unique/m-p/1369899/highlight/true#M77380" target="_self"&gt;Selecting the most recent records based on unique values in another field&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I couldn't find a way to do it in a SQL expression. Only in a database view.&lt;/P&gt;&lt;P&gt;Sample Excel data:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-views-view-that-selects-from-an/idi-p/1369894?attachment-id=78021" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-views-view-that-selects-from-an/idi-p/1369894?attachment-id=78021&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 06:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/one-to-first-join-control-what-related-record-gets/idc-p/1369987#M28023</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-15T06:53:57Z</dc:date>
    </item>
  </channel>
</rss>

