0

Please see the screenshot below. I am trying to update tid with sid where teacher's emailaddress equals student's email address. I've tried different methods and it's either I get an empty result or multipart identifier error. Kindly help.

screenshot of the problem

For instance, the kind of answer I expect would be, tid on row 1 would be 3, row 2 would be 2, row3 would be 2, and row 4, 1

Martin Smith
  • 438,706
  • 87
  • 741
  • 845
bdfios
  • 657
  • 6
  • 17
  • 29

1 Answers1

1

Should just be something simple like

Update s
Set tid = t.sid
From table s
Inner join table t on s.teacheremail = t.studentemail
Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166