67,538
社区成员
发帖
与我相关
我的任务
分享
create table test(
time varchar2(20),
sign varchar2(5)
);
insert into test values('2010-05-26','yes');
insert into test values('2010-05-26','yes');
insert into test values('2010-05-26','no');
insert into test values('2010-05-27','yes');
insert into test values('2010-05-26','yes');
insert into test values('2010-05-27','no');
select time,
sum(case sign when 'yes' then 1 else 0 end) yes,
sum(case sign when 'no' then 1 else 0 end) no
from test
group by time


字段....times 是 否
2010-03-09 2 2
2010-03-09 1 2