I have this query and works fine. The output shows the different records between two tables. Is there a way to know what is different in each record? Sometimes, the output returns over 1,000 records. It is not possible to go over all columns of each record to compare what has been changed. If there there is another query to show the emp ID (A.employee) and the only different contents of each column of each record, that will be great.
Please advise.
select A.*
from TP2000 A
left join TP2000Prev B
on B.employee = A.employee
where
NOT (B.employee = A.employee and
B.firstname = A.firstname and
B.middlename = A.middlename and
B.lastname = A.lastname and
B.addr1 = A.addr1 and
B.addr2 = A.addr2 and
B.city = A.city and
B.state = A.state and
B.zip = A.zip and
B.hmphonenbr = A.hmphonenbr and
B.datehired = A.datehired and
B.termdate = A.termdate and
B.department = A.department and
B.departmen2 = A.departmen2 and
B.jobcode = A.jobcode and
B.jobdescrip = A.jobdescrip and
B.empstatus = A.empstatus and
B.emergconta = A.emergconta and
B.emergphone = A.emergphone)
OR b.employee is null
Please advise.
select A.*
from TP2000 A
left join TP2000Prev B
on B.employee = A.employee
where
NOT (B.employee = A.employee and
B.firstname = A.firstname and
B.middlename = A.middlename and
B.lastname = A.lastname and
B.addr1 = A.addr1 and
B.addr2 = A.addr2 and
B.city = A.city and
B.state = A.state and
B.zip = A.zip and
B.hmphonenbr = A.hmphonenbr and
B.datehired = A.datehired and
B.termdate = A.termdate and
B.department = A.department and
B.departmen2 = A.departmen2 and
B.jobcode = A.jobcode and
B.jobdescrip = A.jobdescrip and
B.empstatus = A.empstatus and
B.emergconta = A.emergconta and
B.emergphone = A.emergphone)
OR b.employee is null