SELECT OfficeId, JoiningDate, ReleaseDate FROM trns.EmployeeTransfer WHERE EmployeeId = 521
Order By JoiningDate
------------------------------------------------------------------------------------------------------------------
SELECT OfficeId, JoiningDate, ReleaseDate ,
isNUll(
LEAD(ISNULL(OfficeId,0)) OVER (ORDER BY JoiningDate)
, isNull(OfficeId, 0)
) AS NextOfficeId
FROM trns.EmployeeTransfer
WHERE EmployeeId = 521
No comments:
Post a Comment