<?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: explain SQL statement for Branch version in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1145973#M32469</link>
    <description>&lt;P&gt;MB_ is the reference (name) assigned to the records returned by the query encased in parenthesis directly preceding it.&amp;nbsp; You can think of it as a variable that can be referenced (It is referenced before it is "set" when the code says "&lt;SPAN&gt;Select MB_.GDB_ARCHIVE_OID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From")&lt;/SPAN&gt;. In this case you are selecting the GDB_ARCHIVE_OID field from the result set of the query:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(SELECT GDB_ARCHIVE_OID,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ROW_NUMBER() OVER (PARTITION BY OBJECTID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ORDER BY gdb_from_date DESC) rn, gdb_is_delete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM Buildings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WHERE (gdb_branch_id = 0 AND&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gdb_from_date &amp;lt;= '12.31.9999 23:59:59.000'))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Partition is to complicated to go into here, but its used to perform calculations on subsets.&amp;nbsp; Here's a link:&lt;A href="https://www.sqlshack.com/sql-partition-by-clause-overview/" target="_blank"&gt;https://www.sqlshack.com/sql-partition-by-clause-overview/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DESC just tells the query (subquery in this case) to order the returned records in descending order&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"rn" and 'gdb_is_delete" are fields returned by the query being referenced by MB_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Looks like this query is getting all existing (non-deleted) buildings from a FC base table name "Buildings" in the Default version (gdb_branch_id = 0); and its using three select statements to do it...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To me its some pretty heady stuff, but might point me to the answer to a question I have, which is how to I pull a reference to just my existing features from a branch versioned (BV) database.&amp;nbsp; Sort of an "versioned view" for BV...&amp;nbsp; Can you share where you found the SQL code?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 20 Feb 2022 12:57:56 GMT</pubDate>
    <dc:creator>KimberlyGarbade</dc:creator>
    <dc:date>2022-02-20T12:57:56Z</dc:date>
    <item>
      <title>explain SQL statement for Branch version</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1145970#M32468</link>
      <description>&lt;P&gt;dears i am working on Branch version, i want to view a specific version so i search and found the following statement but i don't&amp;nbsp; understand it well, so would some one explain some terms like MB_, ROW_NUMBER, PARTITION, rn.&lt;/P&gt;&lt;P&gt;SELECT Objectid, shape&amp;nbsp;&lt;BR /&gt;FROM Buildings&lt;BR /&gt;WHERE Buildings.GDB_ARCHIVE_OID IN&lt;BR /&gt;(Select MB_.GDB_ARCHIVE_OID&lt;BR /&gt;From&lt;BR /&gt;(SELECT GDB_ARCHIVE_OID,&lt;BR /&gt;ROW_NUMBER() OVER (PARTITION BY OBJECTID&lt;BR /&gt;ORDER BY gdb_from_date DESC) rn, gdb_is_delete&lt;BR /&gt;FROM Buildings&lt;BR /&gt;WHERE (gdb_branch_id = 0 AND&lt;BR /&gt;gdb_from_date &amp;lt;= '12.31.9999 23:59:59.000')) MB_&lt;BR /&gt;WHERE rn = 1 AND gdb_is_delete = '0' );&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 09:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1145970#M32468</guid>
      <dc:creator>DasheEbra</dc:creator>
      <dc:date>2022-02-20T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: explain SQL statement for Branch version</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1145973#M32469</link>
      <description>&lt;P&gt;MB_ is the reference (name) assigned to the records returned by the query encased in parenthesis directly preceding it.&amp;nbsp; You can think of it as a variable that can be referenced (It is referenced before it is "set" when the code says "&lt;SPAN&gt;Select MB_.GDB_ARCHIVE_OID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;From")&lt;/SPAN&gt;. In this case you are selecting the GDB_ARCHIVE_OID field from the result set of the query:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(SELECT GDB_ARCHIVE_OID,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ROW_NUMBER() OVER (PARTITION BY OBJECTID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ORDER BY gdb_from_date DESC) rn, gdb_is_delete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM Buildings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WHERE (gdb_branch_id = 0 AND&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gdb_from_date &amp;lt;= '12.31.9999 23:59:59.000'))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Partition is to complicated to go into here, but its used to perform calculations on subsets.&amp;nbsp; Here's a link:&lt;A href="https://www.sqlshack.com/sql-partition-by-clause-overview/" target="_blank"&gt;https://www.sqlshack.com/sql-partition-by-clause-overview/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DESC just tells the query (subquery in this case) to order the returned records in descending order&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"rn" and 'gdb_is_delete" are fields returned by the query being referenced by MB_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Looks like this query is getting all existing (non-deleted) buildings from a FC base table name "Buildings" in the Default version (gdb_branch_id = 0); and its using three select statements to do it...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To me its some pretty heady stuff, but might point me to the answer to a question I have, which is how to I pull a reference to just my existing features from a branch versioned (BV) database.&amp;nbsp; Sort of an "versioned view" for BV...&amp;nbsp; Can you share where you found the SQL code?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 12:57:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1145973#M32469</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-02-20T12:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: explain SQL statement for Branch version</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1146144#M32476</link>
      <description>&lt;P&gt;thanks Kim,&lt;/P&gt;&lt;P&gt;this statement from ESRI on youtube, here's the link.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=Ln0shBwhvaU&amp;amp;t=847s" target="_blank"&gt;https://www.youtube.com/watch?v=Ln0shBwhvaU&amp;amp;t=847s&lt;/A&gt;&lt;/P&gt;&lt;P&gt;one more thing if you know how could i use named branch version in map viewer!!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 13:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/explain-sql-statement-for-branch-version/m-p/1146144#M32476</guid>
      <dc:creator>DasheEbra</dc:creator>
      <dc:date>2022-02-21T13:19:13Z</dc:date>
    </item>
  </channel>
</rss>

