mysql使用update以及select导数据

1、单表字段更新

update daoshu set leixing = '3' where leixing ='三相'

2、多表查询后关联更新字段

UPDATE d_meter a
JOIN (select q.CONS_ID,w.leixing from c_cons q,daoshu w where q.CONS_NAME = w.huming
AND q.ELEC_ADDR = w.hudizhi) b
on a.CONS_ID = b.CONS_ID
SET
a.WIRING_MODE = b.leixing

posted @ 2020-08-18 15:41  记录学习之路  阅读(195)  评论(0编辑  收藏  举报