How to update from select with a Join

后端 未结 2 992
谎友^
谎友^ 2020-12-11 15:22

How can I update a table that is also present in a subquery? Do I have to do it in 2 stages? (create a temporary table - put the selected data in it and then update the fina

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 15:48

    UPDATE invoiceLine
        INNER JOIN terminal
            ON invoiceLine.ctn = terminal.ctn
        INNER JOIN network
            ON terminal.network = network.id
        SET invoiceLine.network = network.label
    

提交回复
热议问题