基于Case语句的组
问题描述:
我在查询中有下面的case语句。基于Case语句的组
case when ID is null then case when netID is null then [text]
when netID is not null then 'UnAssigned' else ID End
else ID end grp
我想分为2类1)从[文本]列中填充的所有记录。 2)remaning 任何想法?有人能指出我的正确方向吗?
答
确定它的工作对我来说...我选择加入另一种情况,然后在SSRS分组
case when ID is null then case when netID is null then 1
when netID is not null then 0 else 0 End
else 0 end grp
感谢后
+0
这可能会使其简化:ID为NULL且NetID为NULL时的情况则为1否则为0结束 – 2013-04-17 14:59:21
你的意思是像“GROUP BY CASE WHEN ID为null,并且NetID为空然后1其他0结束“ – StrayCatDBA 2013-04-08 19:18:14
雅试图说明它没有正确分组.. .. – user1046415 2013-04-08 19:25:16
嗨@user,我试着重新格式化您的示例代码,但它没有任何意义。你有2个'case',但只有1个'end'。请添加另一个'end'? – PowerUser 2013-04-08 19:51:26