This is what I have:
global $wpdb, $month;
$months = $wpdb->get_results( "SELECT *
FROM $wpdb->posts
WHERE post_type = 'post' AND post_status = 'publish'
AND DATE_FORMAT( post_date_gmt, '%Y' ) = $y
GROUP BY DATE_FORMAT( post_date_gmt, '%Y-%m' )
ORDER BY post_date_gmt DESC
");
The problem is, this returns all posts from that time, but I want only posts that are in category 11.
Is there an easy way to achieve this?