SELECT distinct loc.name, loc.imageurl, tu.userid, tu.fname, (SELECT TOP(1) [time] FROM tblcheckin WHERE userid = tf.followerid and flag ='C' ORDER BY [time] DESC) AS [time] , CONVERT(DECIMAL(16, 2), (dbo.DistanceBetween( loc.latitude,loc.longitude,22.302647,73.190144))) as Distance FROM tbl_follower tf INNER JOIN tbluser tu ON tf.followerid = tu.userid LEFT OUTER JOIN tblgetlocation loc ON loc.venueid = (SELECT TOP(1) locationid FROM tblcheckin WHERE userid = tf.followerid and flag ='C' ORDER BY [time] DESC) where tf.userid = 57 and tf.flag='YES'
DELETE FROM TempCountry WHERE CountryID NOT IN ( SELECT MIN(CountryID) FROM TempCountry GROUP BY CountryCode )
...Your Query AND loc.imageurl NOT LIKE '%ss1.4sql.net%'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)