此案例陈述是否有更快的版本?
CASE
WHEN (SELECT STATEMENT) IS NOT NULL
THEN (SELECT STATEMENT)
ELSE 0
END AS [Variable Name]
SELECT STATEMENT
不会从第2行更改为第3行。
谢谢!
答案 0 :(得分:0)
更快地输入...
isnull(statement, 0)
答案 1 :(得分:0)
WITH cte
AS
(
SELECT co11
FROM ...
)
SELECT ISNULL(cte.col1, 0) as [Variable Name]
FROM cte