There's no duplicates. All rows are unique! All what you want to achieve, is to get date with the highest
RequestId
.
I'd suggest to use
MAX() aggregate function with OVER() clause[
^]:
SELECT DISTINCT TaskId, InternalId, NoColumnName, UploadId,
MAX(RequestId) OVER( PARTITION BY TaskId ORDER BY CreatedDate) AS MaxRequestId, CreatedDate, ProcessStatusMappingID
FROM YourTableName