delete table where a = 0

解决方案 »

  1.   

    delete table?
    没很明白。我的SQL大概是这样的
    select sum(a),sum(b) from tab where tab.date >= to_date('2003-01-01','YYYY-DD-MM')目的就是作一个报表,a是一周的数据,b是从年出就开始汇总出来的数据,但是有可能一周里a是0,但是从年初开始数据就不是0了,这样的数据不需要,如何不显示这些数据?
      

  2.   

    select sum(a) a1,sum(b) b1 from tab where tab.date >= to_date('2003-01-01','YYYY-DD-MM') and (a1<>0 or b1<>0)
      

  3.   

    a1 和b1 不是数据库的列可以放在条件语句里么?我也想这样加来着,但是在PL/SQL Developer中报告是无效列名啊。
      

  4.   

    select id,sum(a),sum(b) from tab where tab.date >= to_date('2003-01-01','YYYY-DD-MM') group by id having sum(a)<>0 and sum(b)<>0;
      

  5.   

    只要判断sum(a)是否为零:
    select sum(a),sum(b) from tab where tab.date >= to_date('2003-01-01','YYYY-DD-MM')
    group by id having sum(a)>0;
      

  6.   

    beckhambobo(beckham) 那样是正确的!
      

  7.   

    取值时将id也取出来,
    select id,sum(a),sum(b) from tab where tab.date >= to_date('2003-01-01','YYYY-DD-MM')
    group by id having sum(a)>0;