mysql update based on select result
update customer_entity 
set website_id = 4             
where website_id = 3 
AND email in 
(
    select tt.email 
    from 
    (
        SELECT email 
        FROM `customer_entity` 
        where website_id in (3,4)
        group by email 
        having count(email) &lt;= 1
    ) as tt
)