K kuaishang Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-14 #1 编号 状态TRK001 9TRK001 0TRK002 9TRK002 9TRK003 9TRK004 0TRK003 9TRK004 0TRK005 9TRK006 0TRK007 9查询结果:TRK002,TRK003,TRK005,TRK007
编号 状态TRK001 9TRK001 0TRK002 9TRK002 9TRK003 9TRK004 0TRK003 9TRK004 0TRK005 9TRK006 0TRK007 9查询结果:TRK002,TRK003,TRK005,TRK007
X xnnfan126 Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-14 #2 select distinct 编号,状态 from 表 where 状态='9'
K kuaishang Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-14 #3 不对啊,select distinct 编号,状态 from 表 where 状态='9' 那么编号TRK001也会出现,我要的结果是编号中只要有一个状态为0的都要排除。状态全部为9的编号才能出现!
Y yanghzhou Unregistered / Unconfirmed GUEST, unregistred user! 2009-06-14 #4 select distinct 编号 from 表 where 状态='9'and 编号 not in(select distinct 编号 from 表 where 状态='0')