select * from (select a,b,temp = a+b from t)t where temp='xxx' 

解决方案 »

  1.   

    try--
    select a,b,[temp] = a+b from t where [temp]='xxx' 
      

  2.   

    select a,b,temp = a+b from t where a+b='xxx' 
      

  3.   

    --
    select a,b,temp = a+b from t where a+b='xxx' 
      

  4.   

    看错,用2楼的或者select a,b,temp = a+b from t where a+b='xxx' 
      

  5.   

    说过N次了..SQL在内部的执行顺序大概是这样的
    先执行FROM 如果有JOIN .而会先产生个迪卡尔积..
    然后再执行 WHERE.进行筛选..
    然后才执行 SELECT 进行投影..所以很清楚了..在 WHERE的时候..看不到 SELECT投影的别名..所以select a,b,temp = a+b from t where a+b='xxx' ORSELECT *
    FROM 
    (
        select a,b,temp = a+b from t 
    ) AS T
    where temp='xxx' 
      

  6.   

    可能要把temp的表达式在where后面写出来。语句复杂的话可以借助视图。
      

  7.   

    select id,lie1,lie2,[temp] = lie1+lie2 from t where lie1+lie2 = '3'
    或者
    select * from (select id,lie1,lie2,temp = lie1+lie2 from t) tt where temp='3' 
      

  8.   

    select a,b,temp = a+b from t where a+b='xxx' 
      

  9.   

       既然是这样,怎么SQL语句都没实现把映射放在where 语句之后的功能?
     真可惜,不过谢谢你,你的解释让我完全明白了问题的所在。