Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,


I want to create a monthly report on employees attendance. I have a Attendance table which has fields
1. EmployeeID
2. InTime
3. Out Time

there is another employee table. My problem is if a employee doesn't come or there is holyday then there will be no row for that date in the attendance table. But I want to show all 31 dates of a month. I mean the holyday date will be a blank row. Now how can I do that using store procedure?
Posted

It would not be possible to provide you exact SQL Query without looking at your "Attedance" Table.

Use Left Outer join between your "Employee" table and "Attedance" Table.

SQL LEFT JOIN

Using Outer Joins
 
Share this answer
 
Comments
Ehtesam Ahmed 28-Aug-11 6:05am    
Thanks RaisKazi ..... i think i got my answer.
Create a third temporary table with a row for every day in a month.
Do a LEFT OUTER JOIN between with this temporary table and the Attendance table.
Join this with the employee table and you should a list of all days with employee table.

You can then drop the temporary table.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900