推 wangks:superssn是空的那位仁兄應該是董事長吧 05/16 20:04
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