问题
How to exclude records from results when ID from A table is in PID column of B table for the same PUIDenter image description here
Table A:
PUID PID SYSTEMCODE ID
100000 701848421 A 3207479
Table B:
PUID PID SYSTEMCODE
100000 3207479 B
100000 6805875 B
回答1:
Use not exists
:
select a.*
from tablea a
where not exists (select 1 from tableb b where b.pid = a.id and b.puid = a.puid)
来源:https://stackoverflow.com/questions/64794523/how-to-exclude-records-from-results-when-id-from-a-table-is-in-pid-column-of-b-t