A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi,@harinathu
Welcome to Microsoft T-SQL Q&A Forum!
Please check this:
SELECT [empid],[doj],
DATEADD(mm, -1, getdate()) as date1,
DATEDIFF(mm,[doj],DATEADD(mm, -1, getdate())) as Month1,
CASE WHEN doj <= DATEADD(mm, -1, getdate()) then 1
ELSE 0 END AS Greatorequalthan1Month
FROM [emp]
SELECT [empid],[doj]
FROM [emp]
WHERE doj <= DATEADD(mm, -1, getdate())
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.