如图:如想找出2008-10-17前,direction为+减去direction为—的QTY总共是多少。怎么写?PART_NO DIRECTION DATE QTY
100100001 + 2007-5-27 64
100100001 - 2007-9-25 3032
100100001 - 2008-6-30 231
100100001 - 2008-9-24 402
100100001 + 2008-8-14 600
100100001 - 2007-5-27 32
100100001 + 2008-6-30 7
100100001 + 2007-9-25 3000
100100001 - 2008-8-19 600
100100001 + 2008-9-10 402
100100001 + 2008-6-29 14
100100001 - 2008-10-17 2434
100100001 + 2008-5-26 224
100100001 - 2008-6-29 14
100100001 + 2008-10-17 2434
100100001 + 2007-5-27 64
100100001 - 2007-9-25 3032
100100001 - 2008-6-30 231
100100001 - 2008-9-24 402
100100001 + 2008-8-14 600
100100001 - 2007-5-27 32
100100001 + 2008-6-30 7
100100001 + 2007-9-25 3000
100100001 - 2008-8-19 600
100100001 + 2008-9-10 402
100100001 + 2008-6-29 14
100100001 - 2008-10-17 2434
100100001 + 2008-5-26 224
100100001 - 2008-6-29 14
100100001 + 2008-10-17 2434
解决方案 »
- 如何处理大数据量的查询?
- 怎样清理ORACLE中没用的数据 来释放硬盘空间?
- oracle has increased its memory usage over the last x minutes
- 请教oralce9在linux上面安装的问题,不使用安装光盘,而是使用tar文件
- 将数据从Oracle移到SQL2000的问题
- 请教大家,那位有一句sql就能够解决的?
- 请问<=to_date(),这个有用吗,为什么我查不出来?
- 这段代码是什么意思?
- 关于oracle8i的安装问题,急……(在线等)
- Oracle实例名自己会改变,请教原因
- 怎样提高 _RecordsetPtr::MoveNext()的速度?
- 请教下utl_http包中用POST发送数据的编码问题
sum(case when direction='+' then qty else -qty end) over(partition by part_no)
from tb
where to_char(date,'yyyy-mm-dd')<='2008-10-17';
试试看
where date<=to_date('2008-10-17','yyyy-mm-dd');