如
2009-6-1 1
2009-6-2 2
2009-10-2 1
最终想得到的结果是
2009-6 3
2009-10 1
如何实现,望指教
2009-6-1 1
2009-6-2 2
2009-10-2 1
最终想得到的结果是
2009-6 3
2009-10 1
如何实现,望指教
解决方案 »
- SQL语句求助。如何选定分组中的“某一行”数据?
- 项目中药实现个需求,在线等(可能会用到行列转换)在线等
- 求一条去重的SQL语句
- 如何修改这条SQL语句才能实现所要求的效果~~急~~~~
- 请问怎么给select出来的记录集加个序号列?
- 大家来帮我简化sql语句
- 写了一点游标的,执行后,好多错啊,帮我改改!!
- 请教一个数据库加载的问题
- 装了oracle816 for redhat7.2 在SQL*Plus中insert进的都是中文的,为什么一存入服务器后,再select出的就是???了
- oracle rac 实现本地数据库与服务器数据库的选择性数据同步问题
- sql plus几个命令问题!!
- 一个简单的过程
from 表
group by trunc(日期,'mm');
with tmp as
(
select to_date('2009-6-1','yyyy-mm-dd') vdate, 1 amount from dual union all
select to_date('2009-6-2','yyyy-mm-dd') vdate, 2 amount from dual union all
select to_date('2009-10-2','yyyy-mm-dd') vdate, 1 amount from dual
)
select to_char(trunc(vdate,'mm'),'yyyy-mm') 月度, sum(amount) 总数
from tmp
group by trunc(vdate,'mm');月度 总数
---------- ----------
2009-06 3
2009-10 1
from table_name
group by to_char(date_column,'yyyy-mm');
from tmp
group by trunc(vdate,'mm');