sqlserver查询报列名无效,该怎么解决

sqlserver查询报列名无效,该怎么解决

sqlserver查询报列名无效
这个是不会出错的:
select round(case when sum(chae) is null then 0 else sum(chae)  end,2) as chae from (select tzzc.zc_id,tz.tzrq ,zc_mj_new-zc_mj chae,hh.dwbm,hh.uses  from house_tz_zc tzzc inner join house_tz  tz on tz.tz_pk=tzzc.tz_pk inner join house_house hh on tzzc.zc_id=hh.houseid where tz.flag='已调整' and hh.optiondate<='2013-01-01'  and tz.zctype='房屋' )t where tzrq>'2013-01-01'  and  uses='其它用房'



这个是会报列名无效错误的:
select round(case when sum(chae) is null then 0 else sum(chae)  end,2) as chae from (select tzzc.zc_id,tz.tzrq ,zc_mj_new-zc_mj chae,hh.dwbm,hh.uses  from house_tz_zc tzzc inner join house_tz  tz on tz.tz_pk=tzzc.tz_pk inner join house_house hh on tzzc.zc_id=hh.houseid where tz.flag='已调整' and hh.optiondate<='2013-01-01'  and tz.zctype='房屋' )t where tzrq>'2013-01-01'  and SUBSTRING(classifyno, 1, 4) like '0101%'


house_house表的部分字段:
sqlserver查询报列名无效,该怎么解决
------解决思路----------------------
因为第二句,classifyno列没有在派生表t里面