用b表查詢出來的數據更新a表
update a, b
set a.title=b.title, a.name=b.name
where a.id=b.id
用多個表則使用查詢,然後用子查詢代替
update gksite.gk_cmpt as n,
(select a.type as type,a.endTime as end_time,b.cmpt_id as cmpt_id from raceenroll.competition as a,gksite.gk_cmpt as b,common.neucmpt as c where a.cmptId=c.gCmptId and b.cmpt_id=c.gtCmptId and b.cmpt_status=2) as m
set n.cmpt_type=m.type , n.end_time=m.end_time,is_day_rank=0 where n.cmpt_id=m.cmpt_id