-2
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

4

1 回答 1

1

我相信 :

    SELECT email,record_id FROM 
    (
          SELECT email,record_id FROM record_data WHERE email NOT REGEXP 
          ( 
               SELECT GROUP_CONCAT( pattern SEPARATOR  '|' ) FROM blockedcompanies
          )   tmp <--ROMOVE THIS HERE 
    ) <-- and put it here. 
    WHERE email NOT REGEXP( 
          SELECT GROUP_CONCAT(email SEPARATOR  '|' ) FROM unsubscribed 
    );
于 2013-05-14T13:25:49.237 回答