【发布时间】:2018-02-27 21:17:51
【问题描述】:
我引用 MS:
CROSS APPLY 仅返回外部表中产生 表值函数的结果集。
这意味着它不会返回具有空值的行,对吧? 但是,我的查询是:
select ....,cat_custom,....
from ...(various inner joins)...
cross apply
(
select
case
when i.cat1='01' then 1
when i.cat2='04' then 2
when i.cat2='07' then 3
when i.cat2 in ('08') or i.cat3 in ('014','847') then 4
else null
end as cat_custom
) as cat_custom_query
...果然,我得到了带有空值的行。那不是OUTER apply的工作吗?怎么回事?
【问题讨论】:
标签: sql-server tsql cross-apply