create table mainTable as select curr_Table.empID as empID, (currTable.ToTalDays-oldTable.ToTalDays) as DiffDays from currTable left outer join oldTable on currTable.empID = oldTable.empID
This is the query that i use to find the days worked by an employee.
The Problem raises when there is "New Joinee". "oldTable.ToTalDays" will not have any value as no record will be found for "New Joinee" in oldTable. So, for this record DiffDays (Integer-null) results is Zero instead of current total days.
Any way to resolve this problem?