SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts LEFT JOIN wp_term_relationships AS tr1 ON (wp_posts.ID = tr1.object_id) LEFT JOIN wp_term_taxonomy ON ( tr1.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id )
WHERE 1=1 AND ((wp_posts.post_author = 5) OR (wp_term_taxonomy.taxonomy = 'author' AND wp_term_taxonomy.term_id = '199')) AND ((wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'booked_wc_awaiting')))
GROUP BY wp_posts.ID HAVING MAX( IF ( wp_term_taxonomy.taxonomy = 'author', IF ( wp_term_taxonomy.term_id = '199',2,1 ),0 ) ) <> 1
ORDER BY wp_posts.menu_order, wp_posts.post_date DESC
LIMIT 0, 10