SQL语法:查询此表有另外一个表没有的数据

select bei.ExamItem_Code2,*from PeisPatientExamItem ppei
join PeisPatientFeeItem ppfi
on ppfi.ID_PatientFeeItem=ppei.ID_PatientFeeItem
join PeisPatient pp
on pp.ID_Patient=ppfi.ID_Patient
join BasExamItem bei
on bei.ID_ExamItem=ppei.ID_ExamItem
where pp.ID_Patient=5 and
bei.ExamItem_Code2 not in (select ExamItem_Code_R from herpeishkjt1..PeisPatientExamItem)

 

查询体检号为5的,herpeishkjtbfyy库中有ExamItem_Code2,但是herpeishkjt1库中没有ExamItem_Code_R 的所有数据。

 

 

posted on 2017-12-05 22:07  不乱于心_向大牛看齐  阅读(1241)  评论(0编辑  收藏  举报

导航