MySQL update a joined table

后端 未结 4 1507
感动是毒
感动是毒 2020-11-28 05:49

I want to update a table in a statement that has several joins. While I know the order of joins doesn\'t really matter (unless you you are using optimizer hints) I ordered

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 06:14

    This link should give you the syntax that MySQL needs and here is an example. Why do you need to join the two tables? is it to limit the records updated? I am asking because you can also do something like the following:

    update B set B.x=
        where 
    B. is in(
        select A.y 
          from A left outer join B on A.=B.
    )
    

提交回复
热议问题