I have the below table,
id email mgr_email mgr_id ------------------------------- 1 email1 email2 2 email2 email3 3 email3 email4
Use sub query for self join:
Try this:
update mytable set mgr_id=t2.id from (select id, email from mytable) t2 where mytable.mgr_email=t2.email