无法使用phpmyadmin执行查询

时间:2013-05-14 13:10:56

标签: mysql

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 );

这个查询有什么问题?我收到以下语法错误:

  

#1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在'tmp附近使用正确的语法WHERE电子邮件NOT REGEXP(SELECT GROUP_CONCAT(电子邮件SEPARATOR'|')FROM UN'在第4行

1 个答案:

答案 0 :(得分: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 
    );