I have to find employee records who have completed 100 days since their joining
What have you tried?
WHERE join_date < DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()) - 100, 0)
Yes, this also worked. I had tried this way and it was also SELECT EmpName, EMPID FROM Employee
WHERE DATEDIFF(dd,JOININGDATE, GETDATE()) >100;
Thank you for your correct and useful query btw.
This method won't use an index on JOININGDATE because the use of that column within a function is not SARGable, and thus will be inefficient, so preferable to do it Scott's way.