WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
GROUP BY terms.term_id' at line 17]SELECT COUNT( DISTINCT wp6q_posts.ID ) as term_count, terms.term_id as term_count_id FROM wp6q_posts
INNER JOIN wp6q_term_relationships AS term_relationships ON wp6q_posts.ID = term_relationships.object_id
INNER JOIN wp6q_term_taxonomy AS term_taxonomy USING( term_taxonomy_id )
INNER JOIN wp6q_terms AS terms USING( term_id )
LEFT JOIN wp6q_term_relationships ON (wp6q_posts.ID = wp6q_term_relationships.object_id)
WHERE wp6q_posts.post_type IN ( 'product' )
AND wp6q_posts.post_status = 'publish'
AND (
wp6q_posts.ID NOT IN (
SELECT object_id
FROM wp6q_term_relationships
WHERE term_taxonomy_id IN (7)
)
AND
wp6q_term_relationships.term_taxonomy_id IN (350)
)
AND terms.term_id IN ()
GROUP BY terms.term_id