user表中 有 register_date,user_type字段,我想得到
日期 类型1 类型2 类型3
2014-04-22 1 0 1
2014-04-21 0 1 0
这样的结构数据,求大神帮解答.
user表中 有 register_date,user_type字段,我想得到
2014-04-22 1 0 1
2014-04-21 0 1 0
这样的结构数据,求大神帮解答.
select register_date
,sum(decode(user_type,'type1',1,0)) as type1
,sum(decode(user_type,'type1',1,0)) as type2
,sum(decode(user_type,'type1',1,0)) as type3
from user
group by register_date