【发布时间】:2021-12-21 01:45:33
【问题描述】:
所以我的 Postgres 10.8 (json_array_elements not possible) DB 中有一个文本字段。它有一个这样的json结构。
{
"code_cd": "02",
"tax_cd": null,
"earliest_exit_date": [
{
"date": "2023-03-31",
"_destroy": ""
},
{
"date": "2021-11-01",
"_destroy": ""
},
{
"date": "2021-12-21",
"_destroy": ""
}
],
"enter_date": null,
"leave_date": null
}
earliest exit_date 也可以像这样为空:
{
"code_cd": "02",
"tax_cd": null,
"earliest_exit_date":[],
"enter_date": null,
"leave_date": null
}
现在我想找回最早的退出日期,日期在 current_date 之后,并且是最接近 current_date 的日期。从 early_exit_date 的示例中,输出必须是:2021-12-21
有人知道怎么做吗?
【问题讨论】:
标签: arrays json postgresql filter where-clause