SQL CASE ISSUE [英] SQL CASE ISSUE

查看:83
本文介绍了SQL CASE ISSUE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释我如何将以下查询转换为sql server查询,因为我们在sql server中没有解码功能。

can any one explain me how to convert the below query into sql server query,because we don't have decode function in sql server.

  SELECT ID,

       (CASE 

        当NAME IN('A','B','C','D')时DECODE(entry_code,'AA','SURYA','BB','DHONI',entry_code)END)AS IDNAME

来自样本;

 SELECT ID,
       (CASE 
                when NAME IN('A','B','C', 'D') Then DECODE(entry_code,'AA','SURYA','BB','DHONI',entry_code) END) AS IDNAME
FROM SAMPLE;

问候,

推荐答案

我们可以在SQL中使用'CASE .. WHEN .. THEN .. ELSE .. END'语法。

we can use the 'CASE .. WHEN .. THEN .. ELSE .. END' syntax in SQL.

请通过以下帖子..它可能对您有所帮助..

Please go through below thread ..It may helpful you..

https://stackoverflow.com/questions/1559241/decode-function-in-sql-server/45678065

= ================================================== ================

请点击"标记为答案"如果它解决了你的问题和/或"投票有用"如果有帮助的话这对阅读此主题的其他社区成员有益。

===================================================================
Please click "Mark as Answer" if it solved your issue and/or "Vote as helpful" if it helped. This can be beneficial to other community members reading this thread.


这篇关于SQL CASE ISSUE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆