SQL问题 (100分)

W

wupaul

Unregistered / Unconfirmed
GUEST, unregistred user!
我一个表中有两个字段PID和ID
现在我想用SQL找出ID不等于其它记录PID的记录,应该怎样写?
 
Select ID
From Table
where ID not Exists
(Select Pid From Table)
 
Select * From Table
where ID not Exists
(Select Pid From Table)
 
两种都可以
 
多人接受答案了。
 
select * from Table
where ID not in (Select Distinct Pid From Table)

good luck
 

Similar threads

顶部