且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在sql中自定义比较2个表的结果

更新时间:2023-12-01 10:40:10

创建两个视图并将数据转储到其中.确保它们具有相同的列结构.
然后像现在一样使用UNION EXCEPT 比较这两个视图.
Create two views and the dump the data in them. Make sure they have the same column structure.
Then compare the two views using UNION or EXCEPT just like you have done now.


尝试一下,
try this,
select * from
(
    select * from tbl1
    except
    select * from tbl2
) as a
   
union all

select * from
(
    select * from tbl2
    except
    select * from tbl1
) as a


祝您编码愉快!
:)


Happy Coding!
:)