一个表A中有4个字段a1 a2 a3 a4我想控制在a1,a2两个字段同时为空时,不显示数据,当有一个字段不为空时,就显示数据,请教如何写WHERE条件。谢谢

解决方案 »

  1.   

    select *
      from (select decode(trim(a1 || a2), null, 1, 0) data from a) t
     where t.data = 1
      

  2.   

    晕着急写错了
    select a1, a2, a3, a4
      from (select decode(trim(a1 || a2), null, 1, 0) data, a1, a2, a3, a4
              from t1) t
     where t.data = 0
      

  3.   

    select * from table where a1 is not null or a2 is not null
      

  4.   

    where a1 is not null and a2 is not null