<?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: Sorting by Lat\Long in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100402#M5858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;We are running reports out of the database and trying to find a way to sort by Lat\Long in SQL.&amp;nbsp; Has anyone come across a way to tackle this issue?&amp;nbsp; We don't want to maintain a field only for the purpose of ordering records.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Would this work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Ordering by two columns. This query first sorts in ascending order by the FirstName column, then sorts in descending order by the LastName column.&lt;BR /&gt;&lt;BR /&gt;Copy&lt;BR /&gt; SELECT LastName, FirstName FROM Person.Person&lt;BR /&gt;WHERE LastName LIKE 'R%'&lt;BR /&gt;ORDER BY FirstName ASC, LastName DESC ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Found it at a &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms188385.aspx"&gt;microsoft site &lt;/A&gt;&lt;SPAN&gt;after a &lt;/SPAN&gt;&lt;A href="http://www.google.com/#hl=en&amp;amp;xhr=t&amp;amp;q=sorting+in+sql&amp;amp;cp=12&amp;amp;pf=p&amp;amp;sclient=psy&amp;amp;site=&amp;amp;source=hp&amp;amp;aq=0&amp;amp;aqi=&amp;amp;aql=&amp;amp;oq=sorting+in+s&amp;amp;pbx=1&amp;amp;bav=on.2,or.r_gc.r_pw.&amp;amp;fp=cf5fe7836e331b33&amp;amp;biw=1046&amp;amp;bih=807"&gt;google search....&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jun 2011 16:59:00 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2011-06-23T16:59:00Z</dc:date>
    <item>
      <title>Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100401#M5857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We are running reports out of the database and trying to find a way to sort by Lat\Long in SQL.&amp;nbsp; Has anyone come across a way to tackle this issue?&amp;nbsp; We don't want to maintain a field only for the purpose of ordering records.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2011 15:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100401#M5857</guid>
      <dc:creator>BrianGustafson</dc:creator>
      <dc:date>2011-06-23T15:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100402#M5858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;We are running reports out of the database and trying to find a way to sort by Lat\Long in SQL.&amp;nbsp; Has anyone come across a way to tackle this issue?&amp;nbsp; We don't want to maintain a field only for the purpose of ordering records.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Would this work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Ordering by two columns. This query first sorts in ascending order by the FirstName column, then sorts in descending order by the LastName column.&lt;BR /&gt;&lt;BR /&gt;Copy&lt;BR /&gt; SELECT LastName, FirstName FROM Person.Person&lt;BR /&gt;WHERE LastName LIKE 'R%'&lt;BR /&gt;ORDER BY FirstName ASC, LastName DESC ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Found it at a &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms188385.aspx"&gt;microsoft site &lt;/A&gt;&lt;SPAN&gt;after a &lt;/SPAN&gt;&lt;A href="http://www.google.com/#hl=en&amp;amp;xhr=t&amp;amp;q=sorting+in+sql&amp;amp;cp=12&amp;amp;pf=p&amp;amp;sclient=psy&amp;amp;site=&amp;amp;source=hp&amp;amp;aq=0&amp;amp;aqi=&amp;amp;aql=&amp;amp;oq=sorting+in+s&amp;amp;pbx=1&amp;amp;bav=on.2,or.r_gc.r_pw.&amp;amp;fp=cf5fe7836e331b33&amp;amp;biw=1046&amp;amp;bih=807"&gt;google search....&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2011 16:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100402#M5858</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2011-06-23T16:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100403#M5859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That won't work.&amp;nbsp; I am looking for a function or something that actually takes into account that the values are a lat long value pair not just two columns with numbers in them.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2011 18:01:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100403#M5859</guid>
      <dc:creator>BrianGustafson</dc:creator>
      <dc:date>2011-06-23T18:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100404#M5860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What database are you using?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is the geometry storage type?&amp;nbsp; Does it have SQL accessor functions that would allow&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;access to the location (point) or envelope corners (non-point)?&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>Thu, 23 Jun 2011 18:11:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100404#M5860</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2011-06-23T18:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100405#M5861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We have an oracle database which is not oracle spatial.&amp;nbsp; In Toad it says that the shape field is an integer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2011 18:14:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100405#M5861</guid>
      <dc:creator>BrianGustafson</dc:creator>
      <dc:date>2011-06-23T18:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100406#M5862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You have a lot fewer options than if the column was ST_GEOMETRY or even SDO_GEOMETRY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(which doesn't require Spatial -- just Intermedia).&amp;nbsp; You'd get a lot better performance if you&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;added sort_key or lat/lon columns to the business table.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What application will be making the query?&amp;nbsp; And what version?&amp;nbsp; (Accessing shape properties &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is easy from ArcGIS [and unsupported from other applications], but doing an ORDER BY in&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS is difficult.)&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>Thu, 23 Jun 2011 19:47:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100406#M5862</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2011-06-23T19:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100407#M5863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are lat long columns in the table and they are stored as a double.&amp;nbsp; We are planning on running a straight sql query(Toad) and then using that to populate a report in a custom Silverlight application.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jun 2011 00:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100407#M5863</guid>
      <dc:creator>BrianGustafson</dc:creator>
      <dc:date>2011-06-24T00:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by Lat\Long</title>
      <link>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100408#M5864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you have the needed information in the table, then Joe's description of how to use an &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ORDER BY clause should suffice; you just need to determine if you want North-&amp;gt;South&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ordering (DESCending) or South-&amp;gt;North (ASCending), and if you want latitude-major or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;longitude-major ordering. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want ordering by map page, you'd need to either add a page column to the table &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or do the math to simulate one --&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ORDER BY (trunc((lon+180) / 60)*6 + trunc((180-lat)/30)),lon,lat DESC&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[longitude major, N-&amp;gt;S, with 36 pages 60deg x 30deg]&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>Fri, 24 Jun 2011 13:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sorting-by-lat-long/m-p/100408#M5864</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2011-06-24T13:58:13Z</dc:date>
    </item>
  </channel>
</rss>

