查询没有订货的客户的个人信息:
select * from ktab
where not exists (select * from kstab where khh=ktab.khh)
go
查询所用客户都订购了的商品的商品信息:
select * from stab
where not exists (select * from ktab
where not exists (select * from kstab
where sph=stab.sph and khh=ktab.khh ))
go
------解决方案-------------------- 根据字面理解 not exists 就是不存在,exists 就是存在
------解决方案--------------------
这个第2个语句:
查询所用客户都订购了的商品的商品信息:
select * from stab
where not exists (select * from ktab
where not exists (select * from kstab
where sph=stab.sph and khh=ktab.khh ))