Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
mysql>
update user set last_email = (select max(email.date_created) from email join contact on (contact.id = email.contact) join user u on (u.id = contact.user) where user.id = u.id);