日期:2014-05-18  浏览次数:20496 次

两张表求差
其中第一张存储有所有的房间号和床位号(这里假设为两间房,每间四张床),第二张存储已经使用的房间。现在要求剩余的床位的房间编号和床位号。表如图。

select Room_Id,Bed_Id 
from BedAll

where (select BedAll.Room_Id,BedAll.Bed_Id 
from BedAll,Patient 
where BedAll.Room_Id=Patient.Patient_Room and BedAll.Bed_Id=Patient.Patient_Bed)

尝试了很久我都没解决,求高手指教,谢谢了

------解决方案--------------------