案例陈述产生以下结果

案例陈述产生以下结果

本文介绍了案例陈述产生以下结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CASE语句显示替代职位,如下所示

Use a CASE statement to display alternative job titles as follows

Original Title		Displayed title
--------------		---------------
PRESIDENT		CEO
MANAGER			Director
SALESMAN		Consultant
ANALYST			Other
CLERK			Other

ENAME      JOB_TITLE
---------- ----------
KING       CEO
ALLEN      Consultant
WARD       Consultant
TURNER     Consultant
MARTIN     Consultant
SCOTT      Other
FORD       Other
JONES      Director
CLARK      Director
BLAKE      Director
SMITH      Other
MILLER     Other
ADAMS      Other
JAMES      Other

推荐答案

Select EName, Case When JOB_TITLE = 'PRESIDENT' then 'CEO' when JOB_TITLE = 'MANAGER' then 'Director' when JOB_TITLE = 'SALESMAN' then 'Consultant' else 'OTHER' end
from TABLENAME



使用它,希望它将实现您的目标. :-)



Use this,Hopefully it will fulfill your goal. :-)




这篇关于案例陈述产生以下结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 02:47