我想要实现以下目标:
select a,
b,
diff as (b-a)
from some_table;
答案 0 :(得分:1)
你的语法还不远,试试这个:
select a,
b,
b - a as diff
from some_table;
列别名的通用ANSI语法是:
select <expression involving columns> as <alias name>
from some_table
答案 1 :(得分:0)
从some_table选择a,b,a-b作为差异;