作者SickKid ( Dizzy)
看板Database
标题Re: [SQL ] 查询请教
时间Mon May 16 13:54:19 2011
Select * from employee where ssn not in
(select superssn * from employee);
这样就对了…只是 当初superssn 有一笔是null
所以怎麽都跑不出正确结果来
加了一个条件就完全正确了
select * from emplyee where ssn not in
(select superssn * from employee where
suprssn is not null)
※ 引述《tedcat (动静:MSN昵称为主)》之铭言:
: : Employee(name,ssn,bdate, address, sex, salary,superssn)
: : 例:
: : name ssn bdate add sex salary superssn
: : select avg(salary) from employee 这样会把主管的薪水也算进去
: : 请问该怎麽做呢?是SQLplus
: : 谢谢大大
: 我不确定你後来怎麽解决的...
: 但是要找出不是主管的员工,
: select * from employee
: where
: ssn not in (select superssn from employee)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 27.33.3.74
1F:推 wangks:superssn是空的那位仁兄应该是董事长吧 05/16 20:04