我可以这样做:
SELECT
1 AS one,
2 AS two,
1 + 2 AS three;
但我想这样做:
SELECT
1 AS one,
2 AS two,
one + two AS three;
有可能吗?
答案 0 :(得分:4)
你可以这样做:
SELECT one, two, (one+two) as three
FROM
(
SELECT
1 AS one
2 AS two
) t;
答案 1 :(得分:2)
方法是:
SELECT one, two, one + two AS 'three'
FROM (SELECT 1 as 'one', 2 as 'two') myTable