{
"personalDetails": {
"First Name": "Paul",
"Last Name": "Jamessen",
"Work Class": "A+",
"Working Unit": "Management",
"email": "demo@demo.com"
}
}
我想把工作单位是管理层的记录更新到a级,如下所示
{
"personalDetails": {
"First Name": "Paul",
"Last Name": "Jamessen",
"Work Class": "A",
"Working Unit": "Management",
"email": "demo@demo.com"
}
}
1条答案
按热度按时间xxe27gdn1#
你可以用
jsonb_set()
```update the_table
set the_column = jsonb_set(the_column, '{personalDetails,"Work Class"}', '"A"')
where the_column #>> '{personalDetails,"Working Unit"}' = 'Management';