开发者

SQL processing values of user defined columns

开发者 https://www.devze.com 2023-04-01 09:01 出处:网络
I can do that: SELECT 1 AS one, 2 AS two, 1 + 2 AS three; 开发者_StackOverflow社区But I would like to do that:

I can do that:

SELECT
   1 AS one,
   2 AS two,
   1 + 2 AS three;

开发者_StackOverflow社区But I would like to do that:

SELECT
    1 AS one,
    2 AS two,
one + two AS three;

Is it possible?


You can do this:

SELECT one, two, (one+two) as three
FROM 
(
    SELECT 
         1 AS one 
         2 AS two
) t;


A way is this:

SELECT one, two, one + two AS 'three'
FROM (SELECT 1 as 'one', 2 as 'two') myTable
0

精彩评论

暂无评论...
验证码 换一张
取 消