Dear Friends,
I have Table (Employee , OperationDate , OperationNumber )
this table contain more data
I need Get Top1 OperatrionDate for Each Employee
;with cte as (
select
ROW_NUMBER() over (partition by Employee order by OperationDate desc) as Rn
,*
from your_Table
)
select * from cte
where rn = 1
select
Employee
,max(OperationDate) as Latest_date
from your_Table
group by
Employee
select top(1) with ties
employee
,operationdate
,operationnumber
from yourtable
order by row_number(partition by employee order by operationdate desc)
;
1 Like
thank you
can also do this with
join case i think
thinking of other ways ALSO possible to do this
for KNOWLEDGE purpose
could be useful ANYWHERE