I am trying to calculate the length of service for emloyees in years to 2 decimal places.
Here is my sql statement:
Case when coalesce(EL.TermDate,0) =0 then convert(decimal(15,2),round((DATEDIFF(mm,EL.DOH,getdate())/12),2)) else convert(decimal(15,2),round(DATEDIFF(mm,EL.DOH, EL.TermDate)/12,2)) end
The results show the # of years but rounded to Zero places.
If an employee has worked 18 months, then the result s/b 1.50.
How can fix this?