How to find years of experience in SQL

                   



To Find Year of experience in SQL we need to use DATEDIFF

Lets see how




 select (DATEDIFF(Year, DateOfJoining,getdate()))  from   Employee where EmployeeID=@EmployeeID



To get data in months



 select (DATEDIFF(month, DateOfJoining,getdate()))  from   Employee where EmployeeID=@EmployeeID

No comments:

Post a Comment