title: NodeJS Sequelize query for find the nearest pins on map without dupe names
body: <p>I have been stuck on this problem for over 1 day, here is the issue:</p>
  <p>I have a database table called &quot;pins&quot;, where I have columns &quot;id&quot;, &quot;name&quot;, &quot;latitude&quot; and &quot;longitude&quot;</p>
  <p>There are data saved in this table for different pins, e.g.:</p>
  <pre><code>ID   Name   Latitude   Longitude
  1    AAA    10          20
  2    AAA    11          21
  3    BBB    12          22
  4    BBB    13          23
  5    BBB    14          24
  6    CC     15          25
  </code></pre>
  <p>OK, now I want to give a position on the map, say:
  Latitude 13, Longitude: 22</p>
  <p>I want to find the top 3 pins near this given location, ordered by the distance to this given location, without any dupe names.
  Therefore, I want to have the result looks like this:</p>
  <pre><code>ID   Name   Latitude   Longitude
  4    BBB    13          23
  2    AAA    11          21
  6    CC     15          25
  </code></pre>
  <p>How can I do that? Thank you very much!</p>
  <p>I am using the following formula to calculate the distance:</p>
  <pre><code>6371 * 1000 * Acos(Cos(Radians(&quot;13&quot;)) * 
  Cos(Radians(pins.latitude)) * Cos( 
  Radians(&quot;22&quot;) - Radians(pins.longitude)) + Sin( 
  Radians(&quot;13&quot;)) * Sin(Radians(pins.latitude)))
  </code></pre>
  <p>P.S.: I am using MySQL database 5.7</p>