Update with Join
UPDATE [dbo].[StudentSession] SET [AttendanceRecorded] = 1 FROM StudentSession SS JOIN TeacherSession TS ON SS.TeacherSessionId = TS.TeacherSessionId WHERE TS.TeacherSessionStatusId = 4