Fields in the table including xq demand duty_userid duty_username, duty_deptid, duty_deptname, duty_deptnameall, user fields in the table userid, username, fk_deptid, dept department fields in the table deptid, the deptname, deptnamall, user table fk_deptid is foreign keys, related departments in the table deptid, general situation is such, so questions can clear? To change this sentence how to write,
CodePudding user response:
The update
(the select xq. Duty_deptid didxq, duty_deptname dnamexq, duty_deptnameall dnameallxq,
D.d eptid didd, d.d eptname dnamed, d.d eptnameall dnamealld
The from xq, user dept d
Where xq. Duty_userid=user. Userid
And the user. Fk_deptid=d.d eptid)
Set didxq=didd, dnamexq=dnamed, dnameallxq=dnamealld
CodePudding user response:
The update xq set xq duty_deptid, xq. Duty_deptname, xq. Duty_deptnameall(the select dept. Deptid, deptdeptname, dept. Deptnamall from dept, user where dept. The deptid=user. Fk_deptid
And xq. Duty_userid=user. Userid);