我的一张表中有五个字段,为A,B,C,D,E,我现在想吧C,D,E三个字段同时都不为0的数据查出来,换句话说就是如果C,D,E三个字段同时为0,则不显示这条数据,我应该如何写这条SQL语句

解决方案 »

  1.   

    select * from table where c <> 0 and d <> 0 and e <> 0
      

  2.   


    这样不行,我只要吧C,D,E同时为0的数据过滤掉,这样写,就把只要C,D,E有一个为0的,都给过滤掉了举个例子:c=3,d=0,e=0,这条数据我要保留c=0,d=0,e=0,这条数据要过滤掉
      

  3.   

    select * from table where c  <> 0 or d  <> 0 or e  <> 0
      

  4.   

    你刚才没表述清楚, 我现在想吧C,D,E三个字段同时都不为0的数据查出来, 
      

  5.   


    select * from table
    where not exists
    (select * from tables where c=1 and d=0 and e=0)
      

  6.   

    select * from tablename
    where not exits (select * from tablename where c=0 and d=0 and e=0 )
      

  7.   

    select tablename  from dual where instr('000',c||d||e)=0
      

  8.   

    select  * from tablename  where instr('000',c||d||e)=0