有一个表T1(ID char(10),source int)
现想用以下查询为什么字段我无效?select A.Source as F1,A.Source as F2,(F1+F2) from T1 as A
只要是想用 别名相加

解决方案 »

  1.   

    select A.Source as F1,A.Source as F2,(A.Source + A.Source ) as F3 from T1 as A
      

  2.   

    但我在 A.Source 里有一个了查询,得到的结果也是个int,如何实现了呢?因为不是单纯的一个A.Source! 怎样才可以用别名相加?
      

  3.   

    不能相加,a.source 中的东东只好再写一次
      

  4.   

    select f1,f2,f1+f2 from (select A.Source as F1,A.Source as F2 from T1) derivedtbl
      

  5.   

    多谢,怎解有个 “derivedtbl"就OK的?