SELECT email, record_id
FROM ( SELECT email, record_id
FROM record_data
WHERE email NOT REGEXP ( SELECT GROUP_CONCAT( pattern SEPARATOR '|' )
FROM blockedcompanies ) tmp
)
WHERE email NOT REGEXP(SELECT GROUP_CONCAT(email SEPARATOR '|' )
FROM unsubscribed );
Whats wrong with this query? I am getting the following syntax error:
#1064 - 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 'tmp) WHERE email NOT REGEXP(SELECT GROUP_CONCAT(email SEPARATOR '|' ) FROM un' at line 4