<?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 DISTINCT in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486475#M45270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The REST API has a "returnDistinct" option for Query in 10.1 SP1, but I have not tried it yyet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/rest/apiref/query.html"&gt;http://resources.arcgis.com/en/help/rest/apiref/query.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you could add it to the query object, and try it. If that doesn't work you could experiment with just using esri.request() to do the query manually.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Feb 2013 15:19:09 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2013-02-20T15:19:09Z</dc:date>
    <item>
      <title>SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486471#M45266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I???m working on a project to identify sexual offenders by their alias name(s). When I do a query on an alias name it displays the master name (given name) and location. However an offender with the master name of James may have multiple alias???s like: Jim, Jimmy and Jimmie.&amp;nbsp; I want to remove the duplicate results and display the master name and location only once. Can I remove the duplicates with a SQL DISTINCT statement? Does anyone have an example of a SQL DISTINCT in a query.where? I???m using ArcGIS 10 Desktop and Server. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jan 2013 16:55:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486471#M45266</guid>
      <dc:creator>GordonBooth</dc:creator>
      <dc:date>2013-01-15T16:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486472#M45267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I also have a need for a DISTINCT in a query.where anyone have suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486472#M45267</guid>
      <dc:creator>JustinPeters</dc:creator>
      <dc:date>2013-02-20T12:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486473#M45268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Found a workaround since DISTINCT is not supported, from &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/esri/arcgis/2009/10/07/using-javascript-to-populate-a-combobox-with-unique-values/"&gt;http://blogs.esri.com/esri/arcgis/2009/10/07/using-javascript-to-populate-a-combobox-with-unique-values/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; //Loop through the QueryTask results and populate an array&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //with the unique values&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var features = results.features;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.forEach (features, function(feature) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zone = feature.attributes.ZONING_TYPE;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!testVals[zone]) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testVals[zone] = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; values.push({name:zone});&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 13:32:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486473#M45268</guid>
      <dc:creator>JustinPeters</dc:creator>
      <dc:date>2013-02-20T13:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486474#M45269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have never tried using the esri.tasks.StatisticDefinition object but it looks like you might be able to use the statisticType = 'count' and then you could use the returned featureset to obtain your unique list based on the onStatisticField. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once you have setup the StatisticsDefinition object then you can use it in your Query Object (esri.tasks.Query)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Query.outStatistics&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, note that there seems to be the following requirements:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Requires ArcGIS Server service version 10.1 or greater (As of v2.6)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) outStatistics is only supported on layers/tables where supportsStatistics is true. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) If outStatistics is specified the only other query parameters that will be used are groupByFieldsForStatistics, orderByFields, text, timeExtent and where.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I do not know is if the StatisticsDefinition only permits statistics on integer fields or if you can use the statistics type = "count" for character fields. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Refer to the Help doc for additional info:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#query"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#query&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 14:37:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486474#M45269</guid>
      <dc:creator>DianaBenedict</dc:creator>
      <dc:date>2013-02-20T14:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486475#M45270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The REST API has a "returnDistinct" option for Query in 10.1 SP1, but I have not tried it yyet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/rest/apiref/query.html"&gt;http://resources.arcgis.com/en/help/rest/apiref/query.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe you could add it to the query object, and try it. If that doesn't work you could experiment with just using esri.request() to do the query manually.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 15:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486475#M45270</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2013-02-20T15:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486476#M45271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The return distinct option in 10.1 SP1 is not yet available in the js api.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 14:04:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486476#M45271</guid>
      <dc:creator>BradBarnell</dc:creator>
      <dc:date>2013-02-22T14:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: SQL DISTINCT</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486477#M45272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In ArcMap, File--add a query layer, then create a SQL query with DISTINCT. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Note although it says add a layer, you do not need to have spatial column. The query will be added as a TABLE. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then run a where="1=1" on this table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 18:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/sql-distinct/m-p/486477#M45272</guid>
      <dc:creator>NianweiLiu</dc:creator>
      <dc:date>2013-03-04T18:50:55Z</dc:date>
    </item>
  </channel>
</rss>

