分组后结果:
年份 年销售量
2007 2000
2008 3000
2009 5000
2010 3210
我想得到这样的结果:再显示一列
年份 年销售量 历年销售总量
2007 2000 2000
2008 3000 5000
2009 5000 10000
2010 3210 13210
... ... ....
用oracle语句怎么查询??
在线等待。。。。。。。。。。。。。。。。
select y,s, sum(s) over(order by s) from test3
select a.year,a.sale,( select sum(b.sale)
from a as b
where a.year >= b.year )
from a
with temp as(
select '2007' yyyy,2000 quantity from dual
union all
select '2008' yyyy,3000 quantity from dual
union all
select '2009' yyyy,5000 quantity from dual
union all
select '2010' yyyy,3210 quantity from dual
)
select yyyy,sum(quantity) over(order by quantity) from temp order by yyyy
看错了,少了一项
with temp as(
相关问答:
我在创建数据库的时候用的名字为oracle10,但是创建好后,在默认的目录下显示的名称却是oracle10g,这是为什么?
你看的 10g是安装目录吧
SQL> select name from v$database;
NAME
---------
ORCL
......
各位oracle高手,请教一下为什么oracle 10g在安装到百分之八十五的时候就报错不能继续安装?
内存多大? 重新下个数据库安装试试..
引用
各位oracle高手,请教一下为什么oracle 10g在安装到百分之八十五的时 ......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
在系统运行的时候总是有一块磁盘始终闪红灯,进入系统后
#topas查看总是有一块磁盘%BUSY为90%以上,
数据库版本:oracle 9.2.0.7
数据文件挂载的节点:/oradata/pcs/ 逻辑卷号lv04
#lslv -l lv04
......
问题提出:
一个高级SQL语句问题
假设有一张表,A和B字段都是NUMBER,
A B
1 2
2 3
3 4
4
有这样一些数据
现在想用一条SQL语句,查询出这样的数据
COLA COL1 COL3 COL2 COL1
4 4 ......