title: remove duplicate records from sql query's result
body: <pre><code>SELECT 
            Distinct  loc.name,             
               loc.latitude, 
               loc.longitude, 
              loc.imageurl,           
               c.userid, 
               c.locationid, 
               c.time,
               (SELECT Count(*)   FROM   tbl_likecheckin  WHERE  checkinid = c.id) AS TOTALCheckin,
              (SELECT Count(*) FROM   tbl_likecheckin  WHERE  userid = 57 AND checkinid =  c.id) As Checkinflag, 
               CONVERT(DECIMAL(16,2),(dbo.Distancebetween(loc.latitude, loc.longitude, 22.302647, 73.190144))) 
               AS 
               Distance 
        FROM   tblcheckin AS C 
               INNER JOIN tbluser AS u 
                       ON c.userid = u.userid 
               INNER JOIN tblgetlocation AS loc 
                       ON c.locationid = loc.venueid 
        WHERE  c.flag = 'C'    
        and   CONVERT(DECIMAL(16,4),(dbo.Distancebetween(loc.latitude, loc.longitude, 22.302647, 73.190144)))&lt;=(select maxdistance from tblDistance)
           ORDER  BY c.time DESC
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/pibyq.png" alt="enter image description here"></p>
  
  <ul>
  <li>Here is the output of my above query, i have applied <strong>distinct</strong> but
  till the data are duplicated because of <strong>imageurl</strong> column</li>
  <li>so how can i remove duplicated record from result no matter which
  duplicated row is removed from result.</li>
  <li>I just want a single record.I need imageurl also.</li>
  </ul>