开发者

SQL processing values of user defined columns

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜