I've been using this formula (by SQL for Enterprise) to get Years of Service as 1 column, like 2.3:
ROUND(CAST(DATEDIFF(MM,((case when PS_EMPLOYMENT.REHIRE_DT IS NOT NULL THEN PS_EMPLOYMENT.REHIRE_DT ELSE PS_EMPLOYMENT.HIRE_DT END)), GETDATE() ) AS DECIMAL(5,2))/ 12,2)
Now I have a request to split Years & Months into 2 columns.
Any tips from the experts?
ThanX !
ROUND(CAST(DATEDIFF(MM,((case when PS_EMPLOYMENT.REHIRE_DT IS NOT NULL THEN PS_EMPLOYMENT.REHIRE_DT ELSE PS_EMPLOYMENT.HIRE_DT END)), GETDATE() ) AS DECIMAL(5,2))/ 12,2)
Now I have a request to split Years & Months into 2 columns.
Any tips from the experts?
ThanX !