日期:2014-05-17 浏览次数:20794 次
select name, sum(decode(ADDRESS, '北京', 1, 0)) 北京, sum(decode(ADDRESS, '上海', 1, 0)) 上海, sum(decode(ADDRESS, '南京', 1, 0)) 南京 from t group by name
select * from t pivot(count(address) for address in('北京', '上海', '南京'));