At first, put the period inside not outside of the month

AND startdate > '2007-06-01'
AND (TerminateDate < '2007-06-30'
OR TerminateDate = '1000-01-01')