Use value of a column for another column (SQL Server)?

后端 未结 4 1654
死守一世寂寞
死守一世寂寞 2021-02-19 00:02

lets say I have a huge select on a certain table. One value for a column is calculated with complex logc and its called ColumnA. Now, for another column, I need the val

4条回答
  •  离开以前
    2021-02-19 00:17

    You could solve this with a subquery and column aliases.

    Here's an example:

    SELECT MaxId + 10
    FROM (SELECT Max(t.Id) As MaxId
          FROM SomeTable t) As SomeTableMaxId
    

提交回复
热议问题