PHP Mysql查询更新多个表,即使某些表为空

时间:2018-07-17 07:32:24

标签: php mysql join


      $update = ("UPDATE branch, custodian, atm_machine_list, computer_list 
        SET branch.branch_name = '$branch_name', 
            custodian.branch_name = '$branch_name', 
            atm_machine_list.branch_name = '$branch_name',
            computer_list.branch_name = '$branch_name',
            branch.branch_code = '$branch_code',
            branch.branch_address = '$branch_address',
            branch.manager = '$manager',
            branch.contact = '$contact' 
        WHERE branch.branch_name LIKE '%$edit_id%'
        AND custodian.branch_name LIKE '%$edit_id%'
        AND atm_machine_list.branch_name LIKE  '%$edit_id%'
        AND computer_list.branch_name LIKE '%$edit_id%'");

我正在尝试更新多个表(分支,托管人,atm_machine_list,computer_list)
我希望即使某些表为空,我的查询仍会更新。

例如,保管人有一个branch_name,而atm_machine_list上没有分支名称,那么不管atm_machine_list为何,它仍会更新,但同时会更新保管人。

希望有人会帮助我。 谢谢

0 个答案:

没有答案