는 내가 두 sce.ACODE 하나가 null이 아닌 수와 위치를 sce.ACODE 다른 하나를 적용 할 필요가 여기에 아래의 SQL 쿼리오라클 적용 카운트 기능은
SELECT
max (bt.NAME) "Batch Type",
max(st.name) "Submission Status",
count(sce.CLIP_POINT)--where sce.ACODE is not null
,count(sce.CLIP_POINT)--where sce.ACODE is null
,sum(sce.CLIP_POINT)--where sce.ACODE is not null
,sum(sce.CLIP_POINT)--where sce.ACODE is null
from SUBMISSION_DATA_ENTRY sde,
BATCH_PROCESSOR bp, status st,SUBMISSION_CLIP_ENTRY sce,
SUBMISSION_PERIOD sp,BATCH_TYPE bt
where sde.sub_perd_id=sp.sub_perd_id
and sde.bpr_pk=bp.bpr_pk and sde.sts_pk=st.sts_pk
and sce.sde_pk=sde.sde_pk
and bt.bat_pk =bp.bat_pk
group by bt.bat_pk, st.sts_pk;
이 null 어떻게 다른 조건으로 같은 열을 계산할 수 있습니다. 도와주세요 SELECT에서 다른 조건
+1하지만'ELSE NULL을 사용하는 방법에 대한 '불필요한'CASE'의 기본값은 NULL이기 때문에 중복되어 있습니다. –
@GoatCO True ...하지만 ELSE가없는 경우는 가려워집니다. – Joe
솔루션을 적용 해 주셔서 고맙습니다.하지만 합계 (예 : sce.acode가 null이고 sce.CLIP_POINT가 아닌 다른 값이 0 인 경우) , sum (sce.acode가 null이 아니고 sce.CLIP_POINT 인 경우)를 적용해야합니다. 0 end) 그러면 양쪽 모두에 대해 동일한 결과가 발생합니다. 어떻게 해결할 수 있습니까? – Krushna