You can first create a cursor that contains one date for every date in the desired range. Call the cursor "TempDates".
Then, join it with the employee table, using a Cartesian Product:
select Employee.EmployeeName, Dates.WorkDate;
from Employee, Dates;
into cursor TempEmployeeDate
Note that in the above exmaple, a JOIN or WHERE clause is missing - in this case, on purpose!
Since a "Cartesian Product" (caused by a missing JOIN or WHERE clause) is often caused by accident, this should be commented, as above.
Next, combine that with your table below; let's assume it is called WorkData.
select WorkData.*;
left join TempEmployeeData;
on WorkData.EmployeeName = TempEmployeeData.EmployeeName;
and WorkData.WorkDate = TempEmployeeData.WorkDate;
into cursor TempResult
Missing data should have NULL values in the corresponding fields; for instance, I think that the above code (untested) should give you NULL for "from" and "to".
>Dear Hilmar
>
>When Normal Query is Run My result is
>
>Date Range 1/1/2004 to 7/1/2004
>
>Date Employee From To
>1/1/2004 Rahul 10:40 18:55
>1/1/2004 Anurag 10:40 17:25
>2/1/2004 Anurag 09:10 18:00
>3/1/2004 Rahul 11:35 16:00
>4/1/2004 Rahul 08:00 18:00
>
>The Result I need is
>
>Date Employee From To
>1/1/2004 Rahul 10:40 18:55
>1/1/2004 Anurag 10:40 17:25
>2/1/2004 Anurag 09:10 18:00
>2/1/2004 Rahul Absent
>3/1/2004 Rahul 11:35 16:00
>3/1/2004 Anurag Absent
>4/1/2004 Rahul 08:00 18:00
>4/1/2004 Anurag Absent
>5/1/2004 Rahul Absent
>5/1/2004 Anurag Absent
>6/1/2004 Rahul Absent
>6/1/2004 Anurag Absent
>7/1/2004 Rahul Absent
>7/1/2004 Anurag Absent
>
>What Ever Date Range is Selected For Every Employee a result should be Displayed .If entry is not in Database he is treated as absent.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)