Maybe this will help as well.
I was looking for a way to group posts in categories automatically by day of the month they were posted and ordered by year. I am not sure if it will work on somebody else blog. You would have to work on the code if you want to change it to month only. The code works in category.php (It might work on category-(*).php or other theme template files as well, but I haven't tested this).
I tried your code first @kittywake, thank you for posting it, it worked like charm. I was looking for something to select on category automatically, and trying to figure out the inner join for that as well, regardless of your code, appeared to be quite daunting. Maybe it is possible to do it with an inner join, however I haven't been able to figure that out, yet.
The following code will semi-automatically select the year based on the value of $groups[0]. So $groups[1] will select a different year than $groups[0]. I have tested this with two years of blog posts, not sure how many years it will work with. The goal is to have it do the year part automatically, but this is proving to be quite difficult so far.
The url's and the styling still needs to be added, but as this is somewhat personal preference I've left it as blanc as possible.
@kittywake: Maybe this set-up will solve your problem with clicking on the month name, as well.
<?php
foreach (get_the_category() as $cat) {
$arch_date_id = $cat->cat_ID;
}
global $post;
$query = 'numberposts=-1&category=' . $arch_date_id . '&orderby=date&order=DESC';
$myposts = get_posts();
foreach($myposts as $post) {
$year = get_the_time('Y');
$groups[] = $year;
}
$groups = array_values(array_unique($groups));
$qi = $groups[0]; // change this number (e.g. to 1) to change the year.
$query = 'cat=' . $arch_date_id . '&year=' . $qi . '&orderby=date&order=DESC&posts_per_page=-1';
query_posts($query);
echo '<h4>' . $qi . '</h4>';
while (have_posts()) : the_post();
?>
<? the_date('F j','<h5>','</h5>');?>
<? the_title();?><br />
<? endwhile; ?>
Feel free to improve.
Code has been written for WordPress 2.8.6