SELECT round(100*(col_a - col_b)/col_a,1) as Foo,Foo - col_c as Bar FROM my_table WHERE...;
但是,我得到一个错误,说Foo是未知的.由于Foo是从一堆其他列的某些计算得出的,所以我不想再为Bar重复该公式.任何解决方法?
SELECT Foo,Foo - col_c as Bar from ( SELECT round(100*(col_a - col_b)/col_a,col_c FROM my_table WHERE... ) t;