有这样几条数据
create table test
(单号 varchar2(10),
投诉类型 int,
投诉地点 varchar2,
投诉时间 date);
insert into test values ('T2',1,'北京',to_date('2017-02-03 15:33:22','yyyy-mm-dd hh24:mi:ss'));
insert into test values ('T3',2,'北京',to_date('2017-02-04 18:53:22','yyyy-mm-dd hh24:mi:ss'));
insert into test values ('T4',1,'天津',to_date('2017-02-05 18:23:22','yyyy-mm-dd hh24:mi:ss'));
insert into test values ('T5',1,'北京',to_date('2017-02-06 14:23:22','yyyy-mm-dd hh24:mi:ss'));
我想统计结果出来是这个效果
序号 地区 2017年1月 2017年2月 2017年3月
1. 北京 NULL 类型1数量2(T2,T5), 类型2数量1(T3) NULL
2. 天津 NULL 类型1数量1(T4) NULL