SQL可以使用In, Not In来查询一个表中的另外一个表里没有的数据,但只能是单一的字段。当字段多个的时候怎么办呢?
举例:mz_detail_charge和 mz_receipt表中
select distinct a.patient_id,a.ledger_sn,b.patient_id,b.ledger_sn from mz_detail_charge a left outer join mz_receipt b
on a.patient_id=b.patient_id and a.ledger_sn=b.ledger_sn where (b.patient_id is null or b.ledger_sn is null)