# update select 语句(注意:必须使用inner join)
# 语法 update a inner join (select yy from b) c on a.id =c.id set a.xx = c.yy
update cp_sku as a INNER JOIN cp_spu as b ON a.spu_id =b.spu_id set a.spu_name=b.spu_name
mongodb 操作
通过条件查询出数组中符合条件的数据,然后在数组中局部修改
db.getCollection('un_userx').update({"_id":new ObjectId("5b7bc169122165beba4e6759"),
"mg_addressx":{ $elemMatch: { "addr_id":"5b851b7a1fd83c2abe852e4d"}}},{$set:{"mg_addressx.$.username":"ccccc"}})