关于Oracle语句中case when起别名

 
  
SELECT t.status,CASE t.status
                WHEN '失败' THEN '捕获失败'
                ELSE '捕获成功' END "legendValue",
          a.business_name as "xAxisValue",sum(nvl(t.file_cou,0)) as "dataValue",a.syscode
          FROM rep_achivenote_cou t 
          LEFT JOIN  c_business a 
          ON t.business_sys = a.syscode
          WHERE t.status in('自动登记','捕获登记','失败') 
          AND a.business_name is not null

          GROUP BY t.status, a.business_name,a.syscode


case when 语句起别名时不能用as ,直接在end后面写上别名即可。

你可能感兴趣的:(Oracle)