t.col + 1您能否告诉我此查询中的表达式将被物理计数多少次?
select t.col + 1 as first,
t.col + 1 as second,
case
when t.col + 1 = 10
then X
when t.col + 1 = 20
then Y
end as caseVal
from table
t.col + 1您能否告诉我此查询中的表达式将被物理计数多少次?
select t.col + 1 as first,
t.col + 1 as second,
case
when t.col + 1 = 10
then X
when t.col + 1 = 20
then Y
end as caseVal
from table
col != 9 则四次,col = 9 则三次。
该表达式将被执行三次。
t.col + 1求值一次以计算该列的值first。t.col + 1以计算列的值second。t.col + 1在条件语句中被第三次求值case。