<?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: SELECT COUNT in File Geodatabase in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753688#M42377</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There won't be a solution for this until &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/38383-Adodb-Count-Maximum-Minimum?p=129796&amp;amp;viewfull=1#post129796"&gt;10.1 is released&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2011 11:22:27 GMT</pubDate>
    <dc:creator>VinceAngelo</dc:creator>
    <dc:date>2011-09-21T11:22:27Z</dc:date>
    <item>
      <title>SELECT COUNT in File Geodatabase</title>
      <link>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753687#M42376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to query a file geodatabase for the equivalent of&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"select count(*) from table_xy" without having to iterate over the result of an IQueryDef.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using ITable.Rowcount is not an option, as the queries have to join over several tables. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is performance critical, the tables contain millions of rows, so doing a full table scan in ArcObjects is not an option.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So far, the only workaround I have found is to create a table "numbers" with integers from 1 to 10000 (MAXINT?) and then doing an IQueryDef-Search like this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT num FROM numbers WHERE num=(SELECT count(*) FROM table_xy)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While yielding the correct result, for obvious reasons this is not an acceptable solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The next thing I tried was executing this statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE numbers SET numbers.num =(select count(*) from table_xy)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is syntactically accepted by the File Geodatabase and executed, but the result is always 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So while obviously the FGDB _can_ calculate the correct values, there doesn't seem to be a convenient way to retrieve it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone give a better (an still fast) solution for this problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Robin Syllwasschy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 08:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753687#M42376</guid>
      <dc:creator>RobinSyllwasschy</dc:creator>
      <dc:date>2011-09-21T08:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT COUNT in File Geodatabase</title>
      <link>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753688#M42377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There won't be a solution for this until &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/38383-Adodb-Count-Maximum-Minimum?p=129796&amp;amp;viewfull=1#post129796"&gt;10.1 is released&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- V&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 11:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753688#M42377</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2011-09-21T11:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT COUNT in File Geodatabase</title>
      <link>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753689#M42378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for this clarification, Vince.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just hoped there might be some way to work around this limitation in 10.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Robin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 11:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753689#M42378</guid>
      <dc:creator>RobinSyllwasschy</dc:creator>
      <dc:date>2011-09-21T11:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT COUNT in File Geodatabase</title>
      <link>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753690#M42379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I might be missing something here with respect to the programming environment you might be tied to, but the geoprocessing environment has the Get Count tool, and if you really need to do this with SQL, and your OID values are a sequence, then select something like OID = (select max(OID) from table_xy) is fast.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2011 14:44:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/select-count-in-file-geodatabase/m-p/753690#M42379</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2011-09-22T14:44:16Z</dc:date>
    </item>
  </channel>
</rss>

