I am trying to get the latest data records against each id ( the status may vary but we just need the status of the latest date )
RoeNumer() and Max(date) are not compatible:
Eg:
I have tried
Select a.Casedep,b.id,b.Max(date),b.Status from table1 as a inner join tabe2 as b on a.id =b.id
and
Select a.Casedep,b.id,b.date,b.Status from table1 as a inner join tabe2 as b on a.id =b.id inner join (Select Max(EventTime) from table2 where b3.id = b.id) as b3 on b.id= b3.id
and Row_Number() and cross apply doesn't work as its old version of SQL
The result I am getting at this time is one with all values of status and date.