Database two table ABs in the same structure or the similar structure to see the anti-set of A-BA n b(a ​​n b)

xiaoxiao2021-03-06  21

Database two table ABs in the same structure or the similar structure to see the anti-set of A-B / A n b / (a ​​n b)

Example: Tables A and Table B have only one field TEL.

(A - b)

Select * from a left join b on a.tel = b.tel where b.tel is null

(A n b)

Select * from a left join b on a.tel = b.tel where b.tel is not null

Anti-set of (a n b)

SELECT T1.TEL AS TELA, T2.TEL from T1 Right Join T2 on T1.TEL = T2.TEL WHERE T1.TEL IS NULL

转载请注明原文地址:https://www.9cbs.com/read-39465.html

New Post(0)