Code:
INSERT INTO 2ndTable SELECT 1stTable.EmpID, 1stTable.Last_promotion_date, MAX(2ndTable.EmpID) + 1
FROM 1stTable, 2ndTable
WHERE 1stTable.EmpID <> 2ndTable.EmpID OR
1stTable.Last_promotion_date <> 2ndTable.Last_promotion_date
I am not sure if you need to use OR or AND operator there, since I am not clear if you wanted to do it as separate inserts or as single insert. I think you should decide on that. Moreover, you didn't mention what should go into Emp_row_Number when EMPID doesn't match between those 2 tables in question, though I used MAX EMPID + 1 for that too.
Hope that helps.
Cheers
_________________________
- Vijay G
Strive for Perfection