mysql比较两张表差异数据

insert into sb_zjgc_in_sapzcmxb (zjhth,zjzcms)

SELECT

zjhth,zjzcms
FROM
( SELECT t1.zjhth, t1.zjzcms FROM sb_zjgc_in_sapzcmxb t1
UNION ALL SELECT t2.zjhth, t2.zjzcms FROM in_sapzcmxb t2 where t2.zjhth like '%DFPV%' ) t
GROUP BY
zjhth,
zjzcms
HAVING
count( * ) = 1
ORDER BY
zjhth;

posted @ 2023-02-22 17:07  LoveYouLoveMe  阅读(286)  评论(0编辑  收藏  举报