<?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: SQL queries on File Geodatabases in File Geodatabase API Questions</title>
    <link>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112734#M210</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please read the responses to your previous posts before posting new queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/82151-How-to-get-Geometry-type(Point-Line-MultiPoint)-from-a-table-in-File-gdb-data.?p=289296&amp;amp;viewfull=1#post289296"&gt;first paragraph of this one&lt;/A&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/81622-How-to-know-FeatureClasses-in-File-GDB-database-(eg.-topo.gdb)?p=287572&amp;amp;viewfull=1#post287572"&gt;this entire response&lt;/A&gt;&lt;SPAN&gt; apply to this post as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation states that the FGDB API only implements a subset of SQL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A search on "GROUP BY" in these Forums returned &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/68997-TOP-100?p=240595&amp;amp;viewfull=1#post240595"&gt;this reference&lt;/A&gt;&lt;SPAN&gt;, which refers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to the &lt;/SPAN&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=About_building_an_SQL_expression"&gt;ArcObjects implementation&lt;/A&gt;&lt;SPAN&gt; (though it makes sense that they would have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the same restriction).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please post File Geodatabase API questions in the &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/forums/126-File-Geodatabase-API"&gt;appropriate location&lt;/A&gt;&lt;SPAN&gt; in the future.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 May 2013 09:45:55 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2013-05-16T09:45:55Z</dc:date>
    <item>
      <title>SQL queries on File Geodatabases</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112733#M209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i'm writing a sample program to read values of some fields in the table. i wrote a snippet as below - &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SQLStr=L"SELECT STATE_NAME, OBJECTID FROM cities &lt;/SPAN&gt;&lt;STRONG&gt;GROUP BY&lt;/STRONG&gt;&lt;SPAN&gt; STATE_NAME ORDER BY STATE_NAME";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fgdbError err= geodatabase.ExecuteSQL(SQLStr,true,eRows);&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(eRows.Next(CurrRow) == S_OK)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; CurrRow.GetOID(Oid);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; CurrRow.GetString(L"STATE_NAME",value);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;when the ExecuteSQL method is called it returned the error code -2147220985 which means FGDB_E_INVALID_SQL!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the documentaion tells that group by clause is supported. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone please help me resolve the issue??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Kishore.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 04:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112733#M209</guid>
      <dc:creator>kishoremudapaka</dc:creator>
      <dc:date>2013-05-16T04:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: SQL queries on File Geodatabases</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112734#M210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Please read the responses to your previous posts before posting new queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/82151-How-to-get-Geometry-type(Point-Line-MultiPoint)-from-a-table-in-File-gdb-data.?p=289296&amp;amp;viewfull=1#post289296"&gt;first paragraph of this one&lt;/A&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/81622-How-to-know-FeatureClasses-in-File-GDB-database-(eg.-topo.gdb)?p=287572&amp;amp;viewfull=1#post287572"&gt;this entire response&lt;/A&gt;&lt;SPAN&gt; apply to this post as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation states that the FGDB API only implements a subset of SQL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A search on "GROUP BY" in these Forums returned &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/68997-TOP-100?p=240595&amp;amp;viewfull=1#post240595"&gt;this reference&lt;/A&gt;&lt;SPAN&gt;, which refers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to the &lt;/SPAN&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=About_building_an_SQL_expression"&gt;ArcObjects implementation&lt;/A&gt;&lt;SPAN&gt; (though it makes sense that they would have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the same restriction).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please post File Geodatabase API questions in the &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/forums/126-File-Geodatabase-API"&gt;appropriate location&lt;/A&gt;&lt;SPAN&gt; in the future.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 09:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112734#M210</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2013-05-16T09:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: SQL queries on File Geodatabases</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112735#M211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, looking at your query, it&lt;/SPAN&gt;&lt;STRONG&gt; isn't &lt;/STRONG&gt;&lt;SPAN&gt;valid SQL -- There is no grouping function&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;on the ObjectID column (not that the FGDB API supports that, either).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 10:54:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112735#M211</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2013-05-16T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: SQL queries on File Geodatabases</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112736#M212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The ArcObjects implementation reference is for 9.2 and is a bit out of date. The File Geodatabase API is based on the ArcGIS 10.0 file geodatabase implementation with some exceptions. Joins are not supported in the API while they are in ArcGIS. GROUP BY was not supported in the file geodatabase in 10.0. GROUP BY was added to ArcGIS at 10.1, but the API has not been updated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The SQL is invalid you cannot include OBJECTID in the select list. Only the grouping field and summary fields can be included. If you are looking for an list ordered by STATE_NAME and OBJECTID try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT STATE_NAME, OBJECTID FROM cities ORDER BY BY STATE_NAME, OBJECTID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a documentation error in the API documentation that notes GROUP BY, but it is an error and will be corrected in the next release of the API.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 16:31:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/sql-queries-on-file-geodatabases/m-p/112736#M212</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2013-05-16T16:31:52Z</dc:date>
    </item>
  </channel>
</rss>

