This is my query I gave from month and to month for retrieve re leaving employee within that months
select
ED.EmpName,
ED.EmpNo,
OP.Dateofjoining,
ED.deactivedate,
DATEDIFF(MM,OP.Dateofjoining,ED.deactivedate) as Totalmonth
from EmployeeDetails ED
inner join Officialprofile OP on ED.EmpNo=OP.EmpNo
inner join SalaryDetails SD on ED.ExisistingCode=SD.ExisistingCode
inner join MonthDetails MD on SD.Month=MD.Months
where ED.Lcode='UNIT I'and SD.Year='2013' and ED.ActivateMode='N'
and MD.Months>='Augus and MD.Months<='December'
I got result no of month using datediff with between to months but in asp.net I have one textbox in that textbox if i give 3 means I want first 3 month employee only