sql case when then查询语句问题
RT,现有一个cityTable
select *, case when Province='江苏省' then '华东' when Province='浙江省' then '华东' when CityName='上海市' then '华东' when Province='河南省' then '华中' when Province='湖北省' then '华中' when Province='湖南省' then '华中' when Province='广西省' then '华南' when Province='广东省' then '华南' when Province='河北省' then '华北' when CityName='北京市' then '华北' when CityName='天津市' then '华北' else '其他' end as 'District' from cityTable
select * from ( select *, case when Province='江苏省' then '华东' when Province='浙江省' then '华东' when CityName='上海市' then '华东' when Province='河南省' then '华中' when Province='湖北省' then '华中' when Province='湖南省' then '华中' when Province='广西省' then '华南' when Province='广东省' then '华南' when Province='河北省' then '华北' when CityName='北京市' then '华北' when CityName='天津市' then '华北' else '其他' end as 'District' from cityTable) where District='华东'