从两个链接表中查找重复项

时间:2014-04-01 10:47:14

标签: mysql

我有2张桌子

1)接触 2)EMAIL_ADDRESS

所有有关联系人的email_address都存储在email_address表中,并附有联系人ID。

我有以下查询给出错误

SELECT contacts.id  from contacts INNER JOIN 
(select email_address_id from email_address ear 
   group by ear.email_address_id having count(ear.email_address_id) > 1 ) as ed  
   where contacts.deleted=0 AND
   ed.`email_address_id` = email_address.`email_address_id` 
   ORDER BY contacts.date_entered DESC

我收到以下错误

'where子句中的未知列'email_address_id.email_address' 我在解决此查询时需要帮助

0 个答案:

没有答案