I want to get common data using distinct or group by clause in sql server 2012 where my Createddate is the latest
below is the table i have
below is the query i have used to get the common TargetsDate2
select distinct convert(VARCHAR(15),TargetDate,106) as TargetDate2,TargetDate
From LogsObservRequestActivity
Where LogsObservRequestActivity.ActivityID=170
and not TargetDate is null
and isnull(TargetDate,'')<>isnull(TargetDateOriginal,'')
i am able to get common Targetdate2 but i want to order it by createdon desc, i have tried using order by clause but i do not get the expected result, i get all the dates if use order by clause
below is the expected output