<?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 SQL Select Query in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395385#M13434</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to construct an SQL query using the 'Select' tool. Essentially what I am trying to figure out is how to select the first row in an attribute table, with an additional statement only allowing this record to be selected if my Boolean field (in the same attribute table) is equal to 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a bit of background, this step fits into a wider process that I am running in Model builder. The tool factors into a structure that would then create a buffer around the highest ranked points (FID moving from 0 down) in the attribute table. It would then exclude those points that fall within the buffered regions around the highest ranked points (by assigning them a value of 1). This process would repeat until all points had a Boolean field value of 1.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you guys could lend me a hand that would be great,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, Jonty&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Nov 2011 19:17:11 GMT</pubDate>
    <dc:creator>JontyKnox</dc:creator>
    <dc:date>2011-11-29T19:17:11Z</dc:date>
    <item>
      <title>SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395385#M13434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to construct an SQL query using the 'Select' tool. Essentially what I am trying to figure out is how to select the first row in an attribute table, with an additional statement only allowing this record to be selected if my Boolean field (in the same attribute table) is equal to 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For a bit of background, this step fits into a wider process that I am running in Model builder. The tool factors into a structure that would then create a buffer around the highest ranked points (FID moving from 0 down) in the attribute table. It would then exclude those points that fall within the buffered regions around the highest ranked points (by assigning them a value of 1). This process would repeat until all points had a Boolean field value of 1.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you guys could lend me a hand that would be great,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, Jonty&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2011 19:17:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395385#M13434</guid>
      <dc:creator>JontyKnox</dc:creator>
      <dc:date>2011-11-29T19:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395386#M13435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jonty&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your SQL query will be something like; where...:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"ObjectID" = (select min("ObjectID") from Mytable) and "Otherfield" = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Depending on the host database you're working in the syntax may need to be tweaked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See the help on subqueries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 13:54:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395386#M13435</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2011-11-30T13:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395387#M13436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Bruce,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I constricted this from what you gave me, I've tweaked the database slightly since my last post, but the statement accurately reflects what I want to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT MAX( "Departures" ) FROM SORT AND "Boolean" =0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when I verify the statement it still gives me the 'Invalid SQL statement was used' (twice). Any advice what I've messed up with the syntax?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Jonty&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 13:36:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395387#M13436</guid>
      <dc:creator>JontyKnox</dc:creator>
      <dc:date>2011-12-01T13:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395388#M13437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jonty&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is "SORT" a reserved word in your DBMS?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the parenthese around the subquery (select...) will be required.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 13:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395388#M13437</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2011-12-01T13:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395389#M13438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the quick reply. SORT is the table name and is not a reserved word in my DBMS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just broke the query down to basics and the Boolean part works, as does the 'departures' section- only if I change it from Max to some other function such as &amp;gt;10 however. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This leads me to think that perhaps the problem is with the MAX function?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 14:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395389#M13438</guid>
      <dc:creator>JontyKnox</dc:creator>
      <dc:date>2011-12-01T14:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Select Query</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395390#M13439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jonty&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is your host DBMS, or are you using file GDB?&amp;nbsp; Email me at &lt;/SPAN&gt;&lt;A href="mailto:bharold@esri.com"&gt;bharold@esri.com&lt;/A&gt;&lt;SPAN&gt; and i'll determine the correct syntax.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2011 14:08:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/sql-select-query/m-p/395390#M13439</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2011-12-02T14:08:29Z</dc:date>
    </item>
  </channel>
</rss>

