Mysql的EXTRACTVALUE()和UpdateXML()

读取mysql某字段值为xml格式数据的某个节点的部分信息


SELECT EXTRACTVALUE(字段,'/logs/log[attribute::节点属性名 = 节点值]/attribute::节点属性名') as 节点值 FROM tables where id = 1

更新某xml字段的某节点的部分信息,比如修改log字段中更新时间节点的值

update tables set log = UpdateXML(log,'/logs/log[attribute::操作 = "更新数据"]/attribute::更新时间',concat('更更新时间=\"',now(),'\"')) where id = 1

猜你喜欢

转载自wangsir-81.iteye.com/blog/2084493