微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从嵌套选择T-SQL中选择

我希望通过在内部查询中选择它们来修改数据
并计算其中一个修改..
它给出错误..
select count(cvs) from
(
  select 
  cvs,(case Citycode when 123 then 'test' else 'other' end) as CityName,(case ProductCode when '000' then 'test3' when 'ss' then 'xtr' else 'ddd' end) as CardName
  from Applications
)

解决方法

您需要为子查询提供一个别名:
select count(x.cvs) from
(
  select 
  cvs,(case ProductCode when '000' then 'test3' when 'ss' then 'xtr' else 'ddd' end) as CardName
  from Applications
) x

原文地址:https://www.jb51.cc/mssql/75684.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐