What you need to do is use a subquery. You need to create a query that adds a column to identify the month. You then need to use the TOP 1 qualifier and sort by date in descending order and group by month. This query is then used as a subquery in an IN clause to restrict your result set.