以下代码无效。我想拉出相应PACKAGE的BatchHorizon。我无法直接使用"然后BatchHorizon"因为batchhorizon在子查询中。
Case When PACKAGE IN (SELECT DISTINCT PACKAGE
FROM BATCHINGWINDOW AS A
)
Then (SELECT BatchHorizon
FROM BATCHINGWINDOW AS B
WHERE B.PACKAGE = A.PACKAGE
)
else 3
end
答案 0 :(得分:0)
select
Case When O.PACKAGE IN (SELECT PACKAGE
FROM BATCHINGWINDOW
)
Then (SELECT DISTINCT BatchHorizon
FROM BATCHINGWINDOW AS B
WHERE B.PACKAGE = O.PACKAGE
)
else 3
end pack
from table O