从嵌套选择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

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...