在sql中声明的情况 [英] Case when statement in sql

查看:58
本文介绍了在sql中声明的情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家



Dear experts

CASE WHEN isnull(SUM(Opening) ,0))<0 THEN
      --Here i need to make two columns One with the value of opening and another with zer0

    ELSE
      --Here i need to make two columns One with the value of opening and another with zer0CAST -



我怎么能这样做,我试过什么都行不通。

我是sql的新手,让我知道有没有其他方法可以实现这个



请帮忙我先生


How can i do that, I tried something but nothing works fine.
I am very new to sql and let me know is there any another method to achieve this

Please help me sir

推荐答案

编辑并试试这个: -



Edit and try this:-

select Column_Name= CASE Column_Name WHEN SUM(isnull(Opening,0))< 0 THEN '' ELSE 'do something' END from table_name


这篇关于在sql中声明的情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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