<?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 ROW_NUMBER function in FGDB SQL in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idi-p/1370922</link>
    <description>&lt;P&gt;It would help to have a&amp;nbsp;ROW_NUMBER function in FDGB SQL.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;ROW_NUMBER()&lt;SPAN&gt; is a window function that assigns a sequential integer to each row of a query’s result set. Rows are ordered starting from one based on the order specified by the &lt;/SPAN&gt;ORDER BY&lt;SPAN&gt; clause in the window definition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-row_number/" target="_blank" rel="noopener"&gt;https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-row_number/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Use cases:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/arcgis-3-0-2-what-tool-can-select-the-records-with/m-p/1370898#M77491" target="_self"&gt;&lt;SPAN&gt;Select greatest n (no ties), n being greater than 1&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Select greatest n &lt;U&gt;per group&lt;/U&gt; (no ties), n being greater than 1&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/definition-query-to-show-every-nth-record-plus-the/m-p/1515560/highlight/true#M86503" target="_self"&gt;&lt;SPAN&gt;Definition query to show every nth record plus the last record&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Many other use cases. I use the ROW_NUM window function regularly in other databases.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Tue, 06 Aug 2024 20:21:44 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-08-06T20:21:44Z</dc:date>
    <item>
      <title>ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idi-p/1370922</link>
      <description>&lt;P&gt;It would help to have a&amp;nbsp;ROW_NUMBER function in FDGB SQL.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;ROW_NUMBER()&lt;SPAN&gt; is a window function that assigns a sequential integer to each row of a query’s result set. Rows are ordered starting from one based on the order specified by the &lt;/SPAN&gt;ORDER BY&lt;SPAN&gt; clause in the window definition.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-row_number/" target="_blank" rel="noopener"&gt;https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-row_number/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Use cases:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/arcgis-3-0-2-what-tool-can-select-the-records-with/m-p/1370898#M77491" target="_self"&gt;&lt;SPAN&gt;Select greatest n (no ties), n being greater than 1&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Select greatest n &lt;U&gt;per group&lt;/U&gt; (no ties), n being greater than 1&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/definition-query-to-show-every-nth-record-plus-the/m-p/1515560/highlight/true#M86503" target="_self"&gt;&lt;SPAN&gt;Definition query to show every nth record plus the last record&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Many other use cases. I use the ROW_NUM window function regularly in other databases.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 06 Aug 2024 20:21:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idi-p/1370922</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-08-06T20:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371053#M28059</link>
      <description>&lt;P&gt;I'm curious: Are you not able to pull the ObjectID field for this purpose?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 16:34:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371053#M28059</guid>
      <dc:creator>MErikReedAugusta</dc:creator>
      <dc:date>2024-01-17T16:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371102#M28061</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/569244"&gt;@MErikReedAugusta&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ObjectID is static. I want a dynamic row number within a sorted query.&lt;/P&gt;&lt;P&gt;Like this:&amp;nbsp;&lt;SPAN&gt;Select the four largest cities.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1705512740059.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91841iBB0AB1F5DD9F5240/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_0-1705512740059.png" alt="Bud_0-1705512740059.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;objectid in (
    select
        objectid
    from
        (select
            objectid,
            &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;row_number()&lt;/STRONG&gt;&lt;/FONT&gt; over &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;(order by population_2021 desc)&lt;/STRONG&gt;&lt;/FONT&gt; as rownum 
        from
            cities)
    where
        &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;rownum &amp;lt;= 4)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;This works in a mobile geodatabase. And there are enterprise geodatabase equivalents. But as far as I know, there isn't a function like ROW_NUMBER in file geodatabase SQL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 05:49:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371102#M28061</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-18T05:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371251#M28065</link>
      <description>&lt;P&gt;Or if window functions are too difficult to implement in FGDB SQL, then maybe a &lt;A href="https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ROWNUM-Pseudocolumn.html#GUID-2E40EC12-3FCF-4A4F-B5F2-6BC669021726" target="_self"&gt;ROWNUM pseudo-column&lt;/A&gt; would work, similar to what Oracle does:&lt;/P&gt;&lt;PRE&gt;objectid in (
    select
        objectid
    from
        (select
            &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;rownum,&lt;/STRONG&gt; &lt;/FONT&gt;&lt;BR /&gt;            objectid
        from
            cities
        &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;order by
            population_2021 desc&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;
    where
        &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;rownum &amp;lt;= 4)&lt;/STRONG&gt;  &lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 05:52:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1371251#M28065</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-18T05:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1494713#M30761</link>
      <description>&lt;P&gt;Related:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/add-join-pseudo-objectid-row-number-as-unique-id/idc-p/1494711/highlight/true#M30760" target="_self"&gt;Add Join — Pseudo-ObjectID (row number) as unique ID field for 1:M join&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/disallow-1-m-join-layers-as-gp-inputs-instead-of/idi-p/1477009/highlight/true" target="_self"&gt;Disallow 1:M join layers as GP inputs instead of producing unexpected results&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 15 Jul 2024 04:39:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1494713#M30761</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-07-15T04:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1526011#M31700</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/calculate-field-with-sequential-numbers-partition/idi-p/1526000" target="_self"&gt;Calculate Field with sequential numbers, partition by GROUP_ID field, order by VALUES field&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 18:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1526011#M31700</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-08-22T18:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: ROW_NUMBER function in FGDB SQL</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1526715#M31739</link>
      <description>&lt;P&gt;A ROW_NUM pseudo column would also help with&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/join-control-what-related-record-gets-used/idc-p/1526688/highlight/true#M31737" target="_self"&gt;Join — Control what related record gets used.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In a FGDB database view:&lt;/P&gt;&lt;P&gt;ORDER BY on the grouping ID/common ID field, then on the field that we want to prioritize for the one-to-first join, so that the desired row is at the top of each grouping. Reason: one-to-first joins use the related record that has the smallest object ID.&lt;BR /&gt;Replace the real OBJECTID field with a fake/new OBJECTID using ROW_NUM.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Aug 2024 00:27:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/row-number-function-in-fgdb-sql/idc-p/1526715#M31739</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-08-24T00:27:37Z</dc:date>
    </item>
  </channel>
</rss>

