--更新人事表的卡号等于卡登记表的卡号:
update Employee set employee.card_id=EmployeeCard.card_id
from EmployeeCard where Employee.emp_id=employeecard.emp_id and EmployeeCard.CardState=1
--查询人事表的卡号不等于卡登记表的卡号:
select * from employee where emp_id in(select emp_id from employeecard where Employee.card_id!=employeecard.card_id and EmployeeCard.CardState=1)