これらの選択の結果を1つのビューにまとめたいと思います。共通の列はRUNIDですが、右側のテーブルの結果が常に表示されるとは限りません。したがって、空に戻るはずです。これらすべての選択を1つの選択に組み合わせて、さまざまな基準の各カウントにRUNIDを渡すことができると思います。
--COUNT OF S16 ELIGIBLE ACCOUNTS
SELECT PDDETAIL.RUNID, COUNT(*) AS "S16 ELIGIBLE ACCOUNTS"
FROM PDDETAIL
LEFT JOIN PDSTAGES ON (PDDETAIL.PDID = PDSTAGES.PDID AND PDDETAIL.CUST_ID = PDSTAGES.CUST_ID)
WHERE PDSTAGES.PDSTAGE = 'S16ELIGIBLE'
GROUP BY PDDETAIL.RUNID
ORDER BY PDDETAIL.RUNID ASC
;
--COUNT OF S16 MTO SUBMITTED
SELECT PDDETAIL.RUNID,COUNT(*) AS "S16 MTO SUBMITTED"
FROM PDDETAIL
LEFT JOIN PDSTAGES ON (PDDETAIL.PDID = PDSTAGES.PDID AND PDDETAIL.CUST_ID = PDSTAGES.CUST_ID)
WHERE PDSTAGES.PDSTAGE = 'S16MTOREFRESHSUBMITTED'
GROUP BY PDDETAIL.RUNID
ORDER BY PDDETAIL.RUNID ASC
;
--COUNT OF S16 MTO RETURN FAILED
SELECT PDDETAIL.RUNID,COUNT(*) AS "S16 MTO FAILED"
FROM PDDETAIL
LEFT JOIN PDSTAGES ON (PDDETAIL.PDID = PDSTAGES.PDID AND PDDETAIL.CUST_ID = PDSTAGES.CUST_ID)
WHERE PDSTAGES.PDSTAGE = 'S16MTORETURNFAILED'
GROUP BY PDDETAIL.RUNID
ORDER BY PDDETAIL.RUNID ASC
;