Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 17482)
+++ wp-includes/link-template.php	(working copy)
@@ -1110,7 +1110,8 @@
 
 		if ( $in_same_cat ) {
 			$cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
-			$join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
+			if( !empty( $cat_array ) )
+				$join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
 		}
 
 		$posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
