아래처럼 6개 count 조회는 잘 되는데 7개째부터는 서브쿼리 보다 많은 개수가 조회돼요.
원인이 뭔지 알 수 있을까요?
SELECT
COUNT(CASE WHEN EMGY_FEATURE = '1' THEN 1 END) AS EMGY_FEATURE_CTL_CNT,
COUNT(CASE WHEN EMGY_FEATURE = '1'
AND EMGY_FEATURE_CTL = 'Y'
AND EMGY_CALL_ST = '1' THEN 1 END) AS EMGY_CALL_CNT,
COUNT(CASE WHEN EMGY_FEATURE = '1'
AND EMGY_FEATURE_CTL = 'Y'
AND EMGY_ACT_ALERT = '1' THEN 1 END) AS ACT_EMGY_ALRT_CNT,
COUNT(CASE WHEN EMGY_FEATURE = '1'
AND EMGY_FEATURE_CTL = 'Y'
AND EMGY_CAN_ALERT = '1' THEN 1 END) AS CNC_EMGY_ALRT_CNT,
COUNT(CASE WHEN EMGY_FEATURE = '1'
AND EMGY_FEATURE_CTL = 'Y'
AND EMGY_CALL_ST = '1' THEN 1 END) AS EMGY_FEATURE_CTL_Y_CNT,
COUNT(CASE WHEN EMGY_FEATURE = '1'
AND EMGY_FEATURE_CTL = 'Y'
AND EMGY_CALL_ST = '1'
AND EMGY_CALL = 'Y' THEN 1 END) AS EMGY_CALL_Y_CNT--,
--COUNT(CASE WHEN EMGY_FEATURE = '1'
-- AND EMGY_FEATURE_CTL = 'Y'
-- AND EMGY_ACT_ALERT = '1'
-- AND ACT_EMGY_ALRT_YN = 'Y' THEN 1 END) AS ACT_EMGY_ALRT_Y_CNT--,
--COUNT(CASE WHEN EMGY_FEATURE = '1'
-- AND EMGY_FEATURE_CTL = 'Y'
-- AND EMGY_CAN_ALERT = '1'
-- AND CNC_EMGY_ALRT_YN = 'Y' THEN 1 END) AS CNC_EMGY_ALRT_Y_CNT--,
--COUNT(CASE WHEN EMGY_FEATURE = '1'
-- AND EMGY_CALL_ST = '1' THEN 1 END) AS EMGY_CALL_MODIFIABLE_CNT,
--COUNT(CASE WHEN EMGY_FEATURE = '1'
-- AND EMGY_CALL_ST = '1' THEN 1 END) AS ACT_EMGY_ALRT_MODIFIABLE_CNT,
--COUNT(CASE WHEN EMGY_FEATURE = '1'
-- AND EMGY_CALL_ST = '1' THEN 1 END) AS CNC_EMGY_ALRT_MODIFIABLE_CNT
FROM
(
SELECT
---
)
|