比较两个表并给出第二个表中不存在的输出记录 [英] Compare two tables and give the output record which does not exist in 2nd table
问题描述
我正在比较2个表,1个表是视图表(来自其他服务器),另外1个是我的数据库表。输出将显示第2个表中不存在的记录。
使用INTRANET
SELECT *
来自HRS_EMPLOYEEMASTER A
什么不存在(
SELECT 100000
来自UserInfo B
WHERE A.EmployeeNo = B.EmployeeNo
);
但为什么我会收到此错误?
i am comparing 2 tables,1 table is view table(from other server) and the other 1 is my database table.The output will show the record which doesnt exist in 2nd table.
use INTRANET
SELECT *
FROM HRS_EMPLOYEEMASTER A
WHERE NOT EXISTS (
SELECT 100000
FROM UserInfo B
WHERE A.EmployeeNo = B.EmployeeNo
);
But why am i getting this error?
Msg 468, Level 16, State 9, Line 8
Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
我的尝试:
不知道,请指导我解决这个问题,谢谢。
What I have tried:
have no idea ,please guide me for this issue,thank you.
推荐答案
你可以尝试这样的事情。
You can try something like this.
SELECT A.*
FROM HRS_EMPLOYEEMASTER A
WHERE A.EmployeeNo Not In (
SELECT B.EmployeeNo
FROM UserInfo B
);
这篇关于比较两个表并给出第二个表中不存在的输出记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!