我想这样做:
select
id,
sum(field1) as a,
sum(field2) as b,
a - b as result group by id;
但火鸟显示“列未知。”。第“a - b行”中的错误。怎么做到这一点。感谢..
答案 0 :(得分:1)
在减法中也写出sum()
,即
select
id,
sum(field1) as a,
sum(field2) as b,
sum(field1) - sum(field2) as result
group by id;