Not sure what you call your data table, I named it 'your_table'. You can use a query as in my code -
SELECT custm_date
FROM your_table t1
WHERE NOT EXISTS (
SELECT 1
FROM your_table t2
WHERE t2.custm_date = t1.custm_date
AND NOT EXISTS (
SELECT 1
FROM your_table t3
WHERE t3.custm_date = t1.custm_date
AND t3.CetStart = DATEADD(MONTH, n.n, DATEADD(DAY, 1, EOMONTH(t1.custm_date, 1)))
)
)
The subquery above with the alias 'n' generates a sequence of numbers from 1 to the number of months between the next month of the 'custm_date' and December 2024. It then checks for each month in the sequence whether there exists a corresponding 'CetStart' date in your table for the given 'custm_date.' If any month is missing, the 'NOT EXISTS' condition will be true, and that 'custm_date' will not be included in your output result.
To test this, I have done the following -
CREATE TABLE your_table (
custm_date DATE,
CetStart DATE
);
INSERT INTO your_table (custm_date, CetStart) VALUES
('8/1/2023', '10/1/2023'),
('8/1/2023', '11/1/2023'),
('8/1/2023', '12/1/2023'),
('8/1/2023', '1/1/2024'),
('8/1/2023', '2/1/2024'),
('8/1/2023', '3/1/2024'),
('8/1/2023', '4/1/2024'),
('8/1/2023', '5/1/2024'),
('8/1/2023', '6/1/2024'),
('8/1/2023', '7/1/2024'),
('8/1/2023', '8/1/2024'),
('8/1/2023', '9/1/2024'),
('8/1/2023', '10/1/2024'),
('8/1/2023', '11/1/2024'),
('8/1/2023', '12/1/2024'),
('7/31/2023', '8/1/2023'),
('7/31/2023', '9/1/2023'),
('7/31/2023', '10/1/2023'),
('7/31/2023', '11/1/2023'),
('7/31/2023', '12/1/2023'),
('7/31/2023', '1/1/2024'),
('7/31/2023', '2/1/2024'),
('7/31/2023', '3/1/2024'),
('7/31/2023', '4/1/2024'),
('7/31/2023', '5/1/2024'),
('7/31/2023', '6/1/2024'),
('7/31/2023', '7/1/2024'),
('7/31/2023', '8/1/2024'),
('7/31/2023', '9/1/2024'),
('7/31/2023', '10/1/2024'),
('7/31/2023', '11/1/2024'),
('7/31/2023', '12/1/2024'),
('7/28/2023', '8/1/2023'),
('7/28/2023', '9/1/2023'),
('7/28/2023', '10/1/2023'),
('7/28/2023', '11/1/2023'),
('7/28/2023', '12/1/2023'),
('7/28/2023', '1/1/2024'),
('7/28/2023', '2/1/2024'),
('7/28/2023', '3/1/2024'),
('7/28/2023', '4/1/2024'),
('7/28/2023', '5/1/2024'),
('7/28/2023', '6/1/2024'),
('7/28/2023', '7/1/2024'),
('7/28/2023', '8/1/2024'),
('7/28/2023', '9/1/2024'),
('7/28/2023', '10/1/2024'),
('7/28/2023', '11/1/2024'),
('7/28/2023', '12/1/2024');
If you run the sample code I gave you, the output result will be -
custm_date
----------
2023-07-31
2023-07-28
These are the 'custm_date' values for which all the months from August 2023 to December 2024 have corresponding 'CetStart' dates in your table. Any other 'custm_date' with missing months would not be included in your output result set.