<?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: GROUP BY clause crashes pro? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358478#M15776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with &lt;A href="https://community.esri.com/migrated-users/11793" target="_blank"&gt;Marco Boeringa&lt;/A&gt;‌ in that there is obviously a Pro defect because the application should not crash, even with bad syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Speaking of bad syntax, your SQL is definitely not valid.&amp;nbsp; Something that is valid but still doesn't guarantee correct results is:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;ALARM_DATE &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;MAX&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ALARM_DATE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
  &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; CountyOccurrences_firep18_1_A_1000acres
  &lt;SPAN class="keyword token"&gt;GROUP&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;BY&lt;/SPAN&gt; COUNTY_NAME
&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To guarantee correct results, you would need to use a correlated subquery, which unfortunately Esri does not properly support with file geodatabases.&amp;nbsp; You can read &lt;A href="https://community.esri.com/blogs/tilting/2016/10/04/when-exists-doesnt-file-geodatabases-and-correlated-subqueries" target="_blank"&gt;/blogs/tilting/2016/10/04/when-exists-doesnt-file-geodatabases-and-correlated-subqueries&lt;/A&gt; for some more background and examples.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:45:14 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2021-12-11T16:45:14Z</dc:date>
    <item>
      <title>GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358476#M15774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Issue with the GROUP BY clause using ArcGIS PRO 2.4.2 I have a layer and I am attempting to find the most recent occurrence of a phenomenon in each county. I have attempted to use a SQL expression in the Select by Attributes tool. Since SELECT * FROM &lt;TABLE&gt; WHERE is implied, I have entered...&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALARM_DATE =&lt;BR /&gt;(SELECT MAX(ALARM_DATE)&lt;BR /&gt;FROM&lt;BR /&gt;CountyOccurrences_firep18_1_A_1000acres)&lt;BR /&gt;GROUP BY&lt;BR /&gt;COUNTY_NAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything above GROUP BY is valid, but when used on its own just returns the most recent observations in the table. I would like the most recent observations from each county,&amp;nbsp; hence the GROUP BY.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, whenever I add the GROUP BY clause, and attempt to either run it or validate, Pro immediately crashes. Looking for feedback on what's going on, as well as a workaround to perform the selection I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/TABLE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 20:01:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358476#M15774</guid>
      <dc:creator>SFM_TravisBott</dc:creator>
      <dc:date>2020-04-23T20:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358477#M15775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The crash is obviously a bug in ArcGIS Pro, that may or may not be fixed in the more recent V2.5 version of Pro, but alternatively may need reporting to ESRI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As to your specific query: This type of advanced query including GROUP BY doesn't work well directly in dialogs or tools like Select By Attribute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this data stored in an enterprise (geo)database? If so, you have several options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Define a database view that creates the desired output, and load that through the Catalog window (You can use the &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/create-database-view.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/create-database-view.htm"&gt;Create Database View—Data Management toolbox | Documentation&lt;/A&gt; ) tool for creating the view, or database tools).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Use ArcGIS Query Layers to define the SQL and create a layer. See e.g.:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/data/query-layers/what-is-a-query-layer-.htm" title="https://pro.arcgis.com/en/pro-app/help/data/query-layers/what-is-a-query-layer-.htm"&gt;What is a query layer?—Query layers | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/help/data/query-layers/creating-a-query-layer.htm" title="https://pro.arcgis.com/en/pro-app/help/data/query-layers/creating-a-query-layer.htm"&gt;Create a query layer—Query layers | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, have you looked at the &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/summary-statistics.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/summary-statistics.htm"&gt;Summary Statistics—Help | Documentation&lt;/A&gt; tool as well? It may be able to give you the desired output with the right settings for fields and a join back to the original layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 20:33:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358477#M15775</guid>
      <dc:creator>MarcoBoeringa</dc:creator>
      <dc:date>2020-04-23T20:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358478#M15776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with &lt;A href="https://community.esri.com/migrated-users/11793" target="_blank"&gt;Marco Boeringa&lt;/A&gt;‌ in that there is obviously a Pro defect because the application should not crash, even with bad syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Speaking of bad syntax, your SQL is definitely not valid.&amp;nbsp; Something that is valid but still doesn't guarantee correct results is:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;ALARM_DATE &lt;SPAN class="operator token"&gt;IN&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;MAX&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ALARM_DATE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
  &lt;SPAN class="keyword token"&gt;FROM&lt;/SPAN&gt; CountyOccurrences_firep18_1_A_1000acres
  &lt;SPAN class="keyword token"&gt;GROUP&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;BY&lt;/SPAN&gt; COUNTY_NAME
&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To guarantee correct results, you would need to use a correlated subquery, which unfortunately Esri does not properly support with file geodatabases.&amp;nbsp; You can read &lt;A href="https://community.esri.com/blogs/tilting/2016/10/04/when-exists-doesnt-file-geodatabases-and-correlated-subqueries" target="_blank"&gt;/blogs/tilting/2016/10/04/when-exists-doesnt-file-geodatabases-and-correlated-subqueries&lt;/A&gt; for some more background and examples.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:45:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358478#M15776</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T16:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358479#M15777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for all of the responses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got around it by using the Summary Statistics tool and then joining back to the original data set. Wasn't perfect, due to the nature of the dataset, but with some manual winnowing was able to get what I needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The query that I posted in my OP, minus the GROUP BY, definitely did work, just not as intended. However I will take note that the GROUP BY clause should exist within the parenthesis.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 14:47:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358479#M15777</guid>
      <dc:creator>SFM_TravisBott</dc:creator>
      <dc:date>2020-04-28T14:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358480#M15778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you have identified the root cause and a new workflow, please mark a response as correct or the thread as assumed answered to close it out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 19:12:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358480#M15778</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-04-28T19:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: GROUP BY clause crashes pro?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358481#M15779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/398649"&gt;SFM Travis Bott&lt;/A&gt;‌&amp;nbsp; Sorry that you experienced a crash, but glad that you're moving forward.&lt;/P&gt;&lt;P&gt;If you send us (&lt;A href="mailto:kkramer@esri.com"&gt;kkramer@esri.com&lt;/A&gt;) the .dmp files from the associated crash we can get them to the development team to analyze - we have the description of your query from this thread.&amp;nbsp; Go to&amp;nbsp;C:\Users\&amp;lt;username&amp;gt;\AppData\Local\ESRI\ErrorReports and attach a few of the latest .dmp files from Pro crashing.&amp;nbsp; The filename contains a date-time stamp:&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/490493_pastedImage_26.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 13:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/group-by-clause-crashes-pro/m-p/358481#M15779</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2020-04-30T13:32:34Z</dc:date>
    </item>
  </channel>
</rss>

