<?php
// for in or out of "The Loop":
if(is_single()) :
foreach((get_the_category()) as $cat) :
?>
<p>
<?php $my_query = $wpdb->get_results("SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->post2cat WHERE category_id = '$cat->cat_ID' AND ID = post_id AND post_id <> '$id' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 10"); ?>
<?php while(list(,$my_post) = each($my_query)) : ?>
<h2 id="post-<?php echo $my_post->ID; ?>">
<a href="<?php echo get_permalink($my_post->ID); ?>" rel="bookmark" title="Permanent Link to <?php echo $my_post->post_title; ?>">
<?php echo $my_post->post_title; ?></a></h2>
<small><?php echo mysql2date('F jS, Y', $my_post->post_date); ?></small>
<?php endwhile; ?>
</p>
<?php endforeach; endif; ?>