以下是将两个表中任何一个字段的值不相同的记录返回的SQL查询语句:

SELECT *
FROM db1.cm_ccf_protocol_metadata AS t1
JOIN db2.cm_ccf_protocol_metadata AS t2
ON t1.proto_type = t2.proto_type
AND t1.attribute_code = t2.attribute_code
AND t1.use_type = t2.use_type
AND t1.proto_version = t2.proto_version
WHERE t1.attribute_desc <> t2.attribute_desc
OR t1.attribute_display <> t2.attribute_display
OR t1.default_value <> t2.default_value
OR t1.ispassword <> t2.ispassword
OR t1.isbinary <> t2.isbinary
OR t1.if_required <> t2.if_required
OR t1.attribute_type <> t2.attribute_type;

请注意,这是一个简单的示例,只比较了部分字段。如果你想要比较其他字段,请根据需要修改查询语句。另外,请将'db1'和'db2'替换为实际的数据库名称。


原文地址: http://www.cveoy.top/t/topic/V6F 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录