Table structure as below:
EmpID ItemsPurchased EmailID
C12 Bread email@example.com
C15 Watch firstname.lastname@example.org
I would need email ids to populated partitioned by empid. ie., email@example.com should be populated for all rows of C12 and similiarly, firstname.lastname@example.org for C14 empid.
You could use the MAX window function :
select EmpID , ItemsPurchased , EmailID , max(EmailID) over(partition by EmpId) as EmailID_populated from MyTable;