易截截图软件、单文件、免安装、纯绿色、仅160KB

求第一行为统计,下面为明细的oracle中的SQL。

存在这样一个表的数据:
    数1 数2  数3
行1: 1  10    20
行2: 2  20    10
行3: 4  5    10
行4: 5  10    10
现在oracle中使用SQL语句实现如下效果:
    数1 数2  数3
合计:12  45    50
行1: 1  10    20
行2: 2  20    10
行3: 4  5    10
行4: 5  10    10
大家有没有什么好思路,提供一下,最好能把SQL写出来。呵呵 多谢了。


select sum(col1)over(order by col1),sum(col2)over(order by col2),sum(col3)over(order by col3) from table
union all
select col1,col2,col3 from table

来只笨办法,呵呵。。

SQL> select * from test;

      数1        数2        数3
---------- ---------- ----------
        4          5        10
        2        20        10
        1        10        20
        5        10        10

SQL> SELECT SUM(数1) 数1,SUM(数2) 数2,SUM(数3) 数3 from test
  2  U


相关问答:

[原创] ORACLE 连接字串 - Oracle / 非技术区

假设table01 中有 以下资料
emp_no emp_name
------- ------------
0001 TOM
0002 JOHN
0003 MARY
常用电话 
而我们要得到以下的OUTPUT (或是各种其他的output)
0001,TOM
0002,JOHN ......

oracle 安装 01092 错误 - Oracle / 基础和管理

oracle 11g 安装 01092 错误,
日志信息:
[oracle@linux trace]$ vi alert_orcl.log 
MMON started with pid=14, OS id=9089
RESETLOGS after incomplete recovery UNTIL CHANGE 522752
Errors in file / ......

MS SQL作业问题 - MS-SQL Server / 应用实例

如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP

参考:http://hi.baidu.com/toiota ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号