In the Derived Table there's a GROUP BY missing while the outer query groups by too many columns.
And it seems you don't need to nest at all, this should return the same result:
SELECT
COUNT (MB.MB_JOIN_KEY) MEM_COUNT,
CASE WHEN MB.EFF_BEG_DT >= '2009/01/01' AND MB.EFF_END_DT <= '2009/01/31' THEN 'YES' ELSE 'NO' END AS P1_MBRMTH
FROM MB_TABLE MB
WHERE (MB.EFF_BEG_DT >= '2009/01/01' AND MB.EFF_END_DT <= '2009/01/31') OR
(MB.EFF_BEG_DT >= '2009/03/01' AND MB.EFF_END_DT <= '2009/04/30')
)MMM_MB
GROUP BY P1_MBRMTH
Dieter
In the Derived Table there's a GROUP BY missing while the outer query groups by too many columns.
And it seems you don't need to nest at all, this should return the same result:
Dieter