表结构:created table_a (
p_id number,
m_code varchar2(100),
q_receive number,
);
表中数据如下:
201201 S001 10
201205 S001 5
2012011 S001 20要求得到结果:
S001 1季度 10
S001 2季度 15
S001 3季度 15
S001 4季度 35求各位大神指点,在下感谢了先。
p_id number,
m_code varchar2(100),
q_receive number,
);
表中数据如下:
201201 S001 10
201205 S001 5
2012011 S001 20要求得到结果:
S001 1季度 10
S001 2季度 15
S001 3季度 15
S001 4季度 35求各位大神指点,在下感谢了先。
解决方案 »
- oracle连接问题
- 请教大家一个oracle数据库的sql语句
- 请教,关于全文检索.急
- [求助]关于RMAN时的报错
- 怎么样执行10201_database_linux_x86_64.cpio.gz 这个文件?
- 批量更新有重复记录,怎么办
- 又是一个问题,备份相关问题,备份的后的文件扩展名是*.dmo.gz,大侠请关注
- oracle中十進制轉換為16進制
- 在线等待,有哪位老兄提供从现有数据库获取建立现有数据库对象(表,索引,主键...)的脚本?
- 在线等待
- oracle如何查询xml啊 .................................................................
- VC ADO oracle 操作后的结果如何写成excel
with s as (
select "1季度" as name, 201201 as begin_month, 201204 as end_month from dual
union all
select "2季度" as name, 201201 as begin_month, 201207 as end_month from dual
union all
select "3季度" as name, 201201 as begin_month, 201210 as end_month from dual
union all
select "4季度" as name, 201201 as begin_month, 201301 as end_month from dual
)
select t.m_code, s.name, sum(t.q_receive) from table_a t, s
where t.p_id>=s.begin_month and t.p_id<s.end_month
group by t.m_code, s.name order by t.m_code, s.name;