Hi,
Here what I do not know what result you are getting and do not know what you want to make it as single ;-)
I have assumed that you are getting two selects and you want to combine it into single select statement.
For that You could assign it to table variable from there you could get it as single statement I believe.
Here is the query to do that
DECLARE @TempTable Table(
EmpID INT,
EmpName VARCHAR(50),
AttendanceDate DATETIME
);
DECLARE @attendance_date DATETIME
SET @attendance_date = '2014-02-19'
WHILE (@attendance_date <='2014-02-20' )
BEGIN
INSERT INTO @TempTable
SELECT TM.EmployeeID, TM.FullName, @attendance_date as AbsenteeDate FROM TM_User TM
where TM.is_active=1 and TM.EmployeeID not in
(SELECT EM2.EmployeeID from Employee_Attendance EM2 WHERE
convert(varchar(15),EM2.CheckTime,105) = convert(varchar(15),@attendance_date,105))
SET @attendance_date = DATEADD(day,1,@attendance_date)
continue
IF @attendance_date = '2014-02-20'
BREAK;
END
SELECT * FROM @TempTable
Hope this helps you a bit.
Regards,
RK