I want to do something like this:
SELECT round(100*(col_a - col_b)/col_a, 1) as Foo, Foo - col_c as Bar FROM my_table WHERE...;
However, I get the Foo error message unknown. Since Foo is derived from some calculations in a bunch of other columns, I don't want to repeat the formula for Bar again. Any workarounds?
code_martial
source share