By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
WITH yourTable AS (
SELECT 'tharindu' AS Name, 79.94148 AS Longititue, 6.9748404 AS latutute, '00:15:47' AS Time UNION ALL
SELECT 'shane', 79.8630765, 6.8910388, '13:23:24' UNION ALL
SELECT 'shane', 79.862815, 6.8909349, '14:41:29' UNION ALL
SELECT 'shane', 79.8628665, 6.8911084, '09:39:33' UNION ALL
SELECT 'shane', 79.8626956, 6.890992, '11:00:07' UNION ALL
SELECT 'shane', 79.8628831, 6.89099, '11:43:00'
)
SELECT TOP 1 WITH TIES
Name,
Longititue,
latutute,
Time
FROM yourTable
ORDER BY
ROW_NUMBER() OVER (PARTITION BY Name ORDER BY [Time] DESC);
Name | Longititue | latutute | Time |
---|---|---|---|
shane | 79.8628150 | 6.8909349 | 14:41:29 |
tharindu | 79.9414800 | 6.9748404 | 00:15:47 |