0
select x+y as z,
case
when "x"+"y" < 0 then "Less Than Zero"
when "x"+"y" > 0 then "Non Zero"
else "Zero"
end
from sometable;
返回預期結果,但多次添加每行數據。如何優化常見的子表達式?
我嘗試如下,但不工作,以優化查詢..
select x+y as z,
case
when "z" < 0 then "Less Than Zero"
when "z" > 0 then "Non Zero"
else "Zero"
end
from sometable;
始終返回「小於零」。
我在這個查詢上做錯了什麼?如何避免在執行查詢時多次添加A
和B
?