在单个查询中使用多个联接进行更新

时间:2019-12-24 06:38:36

标签: php mysql dbforge

我正在尝试在一个查询中联接4个表,它可以编译,但是返回或不设置任何值。以下是我写的《 QUERY》。请帮忙

UPDATE tbl_venue_charges AS VC
  JOIN tbl_usr_training_master AS TM ON TM.trai_master_id = VC.vnu_chrg_id
  JOIN tbl_trainer_participant_expenses AS TPE ON TPE.trpex_id = VC.vnu_chrg_id
  JOIN tbl_usr_training_master2 AS UTM ON UTM.trai_master2_id = VC.vnu_chrg_id
  JOIN tbl_travelling_expenses AS TEX ON TEX.trv_exp_id = VC.vnu_chrg_id

  SET VC.trai_master_id = TM.trai_master_id AND
      VC.trpex_id = TPE.trpex_id,
      VC.trai_master2_id = UTM.trai_master2_id,
      VC.trv_exp_id = TEX.trv_exp_id;

0 个答案:

没有答案