No problem. Actually, while I’m here…
Include a single category:
AND $wpdb->posts.ID IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
WHERE $wpdb->term_relationships.term_taxonomy_id = [category number])
Exclude multiple categories:
AND $wpdb->posts.ID NOT IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
WHERE $wpdb->term_relationships.term_taxonomy_id IN ([category number], [category number], [category number]))
Include multiple categories:
AND $wpdb->posts.ID IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
WHERE $wpdb->term_relationships.term_taxonomy_id IN ([category number], [category number], [category number]))
Not incredibly efficient, any of them, but they’ll work. ??