代码之家  ›  专栏  ›  技术社区  ›  wusher

在ms sql 2000中的where子句中使用别名列

  •  11
  • wusher  · 技术社区  · 17 年前

    我知道不能在T-SQL的where子句中使用别名列;然而,微软是否为此提供了某种解决方案?

    相关问题:

    2 回复  |  直到 9 年前
        1
  •  28
  •   Jim V.    17 年前

    一种解决方法是使用派生表。

    例如:

    select *
    from 
       (
       select a + b as aliased_column
       from table
       ) dt
    where dt.aliased_column = something.
    

        2
  •  1
  •   Adam    17 年前