Id name password
1001 zhang
1002 li si
1003 fifty
Initial password dictionary table dictionary
Row_num password
1 a
2 b
3 c
The target output of student table
Id name password
1001 zhang a
1002 li si b
1003 fifty c
Initial password table among the equivalent of a table, its corresponding row_num field in students the line number in the table, to update the student table
the password field
I write wrong, the master can help write a
theUpdate student s set password=(select the password from the dictionary d) where s.R OWNUM=d.r ow_num
CodePudding user response:
In fact, the original poster of the original problem was a bit of a problem, because no rownum field in the student table, although there is a column, but may be an error, the original poster can have a try, but the bracket position might have to train:Update student s set password=(select the password from the dictionary d where s.R OWNUM=d.r ow_num);
According to the requirements of the building Lord, so change the look line not:
Update student s set password=(select the password from the dictionary d where substr (s.i d, 4, 1)=d.r ow_num);