可以选用JOIN来实现,例证如下
用SELECT的原语句:
update spms.user
set DirectReport=(select DirectReport from spms.user where UserName='%s')
where UserName in (select UserName from spms.user where DirectReport='%s')
选用JOIN来实现的语句:
update spms.user as u1
inner join spms.user as u2 on u1.DirectReport= u2.UserName
set u1.DirectReport=u2.DirectReport where u2.UserName='%s'
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。