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
  • 419,657
  • 83
  • 708
  • 800
bdfios
  • 627
  • 5
  • 17
  • 28

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,138
  • 14
  • 95
  • 164