【发布时间】:2021-08-16 18:58:10
【问题描述】:
| JsonData |
|---|
| {"DestinationLists" : [{"name" : "Slingshot", "destinations" : [{"Id" : 4155}, {"Id" : 191}, {"Id" : 165}, {"Id" : 183}]}]} |
| {"DestinationLists" : [{"name" : "TVNZ, Mediaworks, Choice", "destinations" : [{"Id" : null}]}, {"name" : "TVNZ, Discovery", "destinations" : [{"Id" : 165}, {"Id" : 183}, {"Id" : 4155}]}]} |
| {"DestinationLists" : [{"name" : "SecondTest", "destinations" : [{"Id" : 103}, {"Id" : 105}]}, {"name" : "ThirdTest", "destinations" : [{"Id" : 3}, {"Id" : 5}]}]} |
我正在尝试对此数据编写一个选择查询,以清空destinations 数组,以防"Id" 中的任何一个为null
所以输出应该是(第二行空destinations数组):-
| JsonData |
|---|
| {"DestinationLists" : [{"name" : "Slingshot", "destinations" : [{"Id" : 4155}, {"Id" : 191}, {"Id" : 165}, {"Id" : 183}]}]} |
| {"DestinationLists" : [{"name" : "TVNZ, Mediaworks, Choice", "destinations" : []}, {"name" : "TVNZ, Discovery", "destinations" : [{"Id" : 165}, {"Id" : 183}, {"Id" : 4155}]}]} |
| {"DestinationLists" : [{"name" : "SecondTest", "destinations" : [{"Id" : 103}, {"Id" : 105}]}, {"name" : "ThirdTest", "destinations" : [{"Id" : 3}, {"Id" : 5}]}]} |
我怎样才能做到这一点?
【问题讨论】:
-
answer 回答你的问题了吗?
标签: sql json postgresql