sql case查询的运用

sql case查询的使用select a.branchcode,(case a.branchnamewhen 全国 then全国when 广东 then粤w

sql case查询的使用

select a.branchcode,       (case a.branchname         when '全国' then          '全国'         when '广东' then          '粤'         when '湖南' then          '湘'         when '湖北' then          '鄂'         when '四川' then          '川'         when '山东' then          '鲁'         when '江苏' then          '苏'         when '重庆' then          '渝'         when '河北' then          '冀'         when '上海' then          '沪'         when '安徽' then          '皖'         when '天津' then          '津'         when '浙江' then          '浙'         when '北京' then          '京'         when '河南' then          '豫'         when '辽宁' then          '辽'         when '深圳' then          '深'         when '福建' then          '闽'         when '大连' then          '粤'         when '广东' then          '粤'         when '厦门' then          '粤'       end) branchname,       (case branchname         when '全国' then          dayvalueprem_pre || '万'         else          dayvalueprem_pre || ''       end) aaadayvalueprem_pre, --日预收       a.monthvalueprem_pre, --月预收       a.monthvalueprem, --月核保价保       a.achievementrate, --月核保达成       a.activeresource --人力  from reportbroker a where a.reportdate = '2012-06-07'   and a.reporttype in ('A01_0', 'A01_1')   and a.branchname not in ('厦门', '大连') order by branchcode;
?