1、格式
update table_a a left join table_b b on a.id = b.biz_id set a.name = b.name where a.name = 'hg'
说明1: 优先做左连接
说明2: on条件关联,可以有多个,多个用and连接
说明3: 赋值
说明4: where过滤
2、示例
update t_hg_demo_p p left join t_hg_demo_t t on p.sn = t.sn and p.year = year(t.create_time) and p.month = month(t.create_time) and p.day = day(t.create_time) and p.hour = date_format(t.create_time, '%H') and p.minutes = date_format(t.create_time, '%i') and p.seconds = date_format(t.create_time, '%s') set p.inverter_out_vol = t.mppt_in_vol,p.inverter_out_ele = t.mppt_in_ele where p.sn = 'hg001'
说明1: 根据时间关联更新另一张表