<?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 FGDB database view — View that selects from an existing view in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idi-p/1369894</link>
    <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1; File Geodatabase:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It would help to be able to create a view on top of an existing view in a file geodatabase.&lt;/P&gt;&lt;P&gt;Currently, in simple cases like SELECT * FROM EXISTING_VIEW,&amp;nbsp; the resulting view has zero rows (incorrect). Whereas in all other geodatabase and database types, a view can select from an existing view without issue.&lt;/P&gt;&lt;P&gt;Use Case:&lt;/P&gt;&lt;P&gt;1. Organization. Break large queries into smaller, more manageable pieces.&lt;/P&gt;&lt;P&gt;2. Also, complex queries like &lt;STRONG&gt;&lt;EM&gt;greatest 1 per group (with ties)&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; See:&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;&amp;nbsp;and my comment about&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/make-query-table-use-date-field-in-join/idc-p/1369460/highlight/true#M27992" target="_self"&gt;FGDB view challenges&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;For example, get the latest row per species group (with ties), and include all the fields from the original table. That can't be done in a single FGDB view due to various FGDB SQL limitations (update: see follow-up reply below). Instead, I want to use multiple stacked views.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A view that gets the latest row per group (but doesn't include the other fields from the original table):&lt;BR /&gt;&lt;PRE&gt;--latest_vw&lt;BR /&gt;select
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;t_species,&lt;/STRONG&gt;&lt;/FONT&gt;
    max(t_date) as &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;t_date&lt;/STRONG&gt;&lt;/FONT&gt;
from
    species_records
group by
    t_species&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;And then a view on top of that view that takes the fields from the original table and joins to LATEST_VW. The join is based on multiple fields: T_SPECIES=T_SPECIES and T_DATE=T_DATE.&lt;BR /&gt;&lt;PRE&gt;--latest_with_other_fields_vw&lt;BR /&gt;select
    species_records.*,
    latest_vw.*
from
    species_records&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;inner join
    latest_vw&lt;/STRONG&gt;&lt;/FONT&gt;
    on species_records.t_species = latest_vw.t_species &lt;BR /&gt;       and species_records.t_date = latest_vw.t_date&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;That approach works in mobile and enterprise geodatabases but not in file geodatabases since "a view on a view" doesn't seem to be supported; the joined fields from LATEST_VW are completely null, which is incorrect.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;If I could create a view on a view, then that would solve the &lt;EM&gt;greatest 1 per group (with ties)&lt;/EM&gt; problem in FGDB SQL.&lt;/P&gt;&lt;P&gt;I've attached sample Excel data that can be loaded into a file geodatabase.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jan 2024 02:45:48 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-01-15T02:45:48Z</dc:date>
    <item>
      <title>FGDB database view — View that selects from an existing view</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idi-p/1369894</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1; File Geodatabase:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It would help to be able to create a view on top of an existing view in a file geodatabase.&lt;/P&gt;&lt;P&gt;Currently, in simple cases like SELECT * FROM EXISTING_VIEW,&amp;nbsp; the resulting view has zero rows (incorrect). Whereas in all other geodatabase and database types, a view can select from an existing view without issue.&lt;/P&gt;&lt;P&gt;Use Case:&lt;/P&gt;&lt;P&gt;1. Organization. Break large queries into smaller, more manageable pieces.&lt;/P&gt;&lt;P&gt;2. Also, complex queries like &lt;STRONG&gt;&lt;EM&gt;greatest 1 per group (with ties)&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; See:&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;&amp;nbsp;and my comment about&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/make-query-table-use-date-field-in-join/idc-p/1369460/highlight/true#M27992" target="_self"&gt;FGDB view challenges&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;For example, get the latest row per species group (with ties), and include all the fields from the original table. That can't be done in a single FGDB view due to various FGDB SQL limitations (update: see follow-up reply below). Instead, I want to use multiple stacked views.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A view that gets the latest row per group (but doesn't include the other fields from the original table):&lt;BR /&gt;&lt;PRE&gt;--latest_vw&lt;BR /&gt;select
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;t_species,&lt;/STRONG&gt;&lt;/FONT&gt;
    max(t_date) as &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;t_date&lt;/STRONG&gt;&lt;/FONT&gt;
from
    species_records
group by
    t_species&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;And then a view on top of that view that takes the fields from the original table and joins to LATEST_VW. The join is based on multiple fields: T_SPECIES=T_SPECIES and T_DATE=T_DATE.&lt;BR /&gt;&lt;PRE&gt;--latest_with_other_fields_vw&lt;BR /&gt;select
    species_records.*,
    latest_vw.*
from
    species_records&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;inner join
    latest_vw&lt;/STRONG&gt;&lt;/FONT&gt;
    on species_records.t_species = latest_vw.t_species &lt;BR /&gt;       and species_records.t_date = latest_vw.t_date&lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;That approach works in mobile and enterprise geodatabases but not in file geodatabases since "a view on a view" doesn't seem to be supported; the joined fields from LATEST_VW are completely null, which is incorrect.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;If I could create a view on a view, then that would solve the &lt;EM&gt;greatest 1 per group (with ties)&lt;/EM&gt; problem in FGDB SQL.&lt;/P&gt;&lt;P&gt;I've attached sample Excel data that can be loaded into a file geodatabase.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 02:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idi-p/1369894</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-15T02:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: FGDB database views — View that selects from an existing view</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idc-p/1370031#M28031</link>
      <description>&lt;P&gt;My 2 cents. Certain SQL operations are only available in a RDBMS (Oracle, SQL Server, PortgreSQL) because the SQL Engine behind the RDBMS that is quite complex. Certain SQL functions in a File Geodatabase might not be available and it will be difficult to implement that because of this reason. Therefore, the best aproach is to move the data from the File Geodatabase to an Enterprise Geodatabase, even Mobile Geodatabase will present some limitations as well, thus move the data to an Enterprise Database (Oracle, SQL Server, PostgreSQL). I hope this helps.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 20:37:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idc-p/1370031#M28031</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2024-01-14T20:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: FGDB database views — View that selects from an existing view</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idc-p/1370044#M28032</link>
      <description>&lt;P&gt;Update&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;For example, get the latest row per species group, and include all the fields from the original table. &lt;STRONG&gt;That can't be done in a single FGDB view&lt;/STRONG&gt; due to various FGDB SQL limitations.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I realize now that is incorrect. It &lt;EM&gt;&lt;U&gt;can&lt;/U&gt;&lt;/EM&gt; be done in a single view:&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;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;--species_records_latest_vw
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;But this idea is still valid. It would still help to create a view on a view.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 02:48:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/fgdb-database-view-view-that-selects-from-an/idc-p/1370044#M28032</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-01-15T02:48:07Z</dc:date>
    </item>
  </channel>
</rss>

