我有一张如下表:
id |first_active |openingtimes_json
8326cdd20459|1970-01-01 01:00:00+01 |{"openingTimes":[{"applicable_days":63,"periods":[{"startp":"06:00","endp":"22:00"}]},{"applicable_days":64,"periods":[{"startp":"07:00","endp":"21:00"}]}]}
d392f7532218|1970-01-01 01:00:00+01 |{"openingTimes":[{"applicable_days":31,"periods":[{"startp":"06:00","endp":"22:00"}]},{"applicable_days":64,"periods":[{"startp":"09:00","endp":"22:00"}]},{"applicable_days":32,"periods":[{"startp":"08:00","endp":"22:00"}]}]}
我想根据 Data Vault 原则有一个卫星表,如下所示:
id |subsq|first_active |applicable_days|startp |endp |
8326cdd20459 |1 |1970-01-01 01:00:00+01 |63 |06:00 |22:00 |
8326cdd20459 |2 |1970-01-01 01:00:00+01 |64 |07:00 |21:00 |
d392f7532218 |1 |1970-01-01 01:00:00+01 |31 |06:00 |22:00 |
d392f7532218 |2 |1970-01-01 01:00:00+01 |64 |09:00 |22:00 |
d392f7532218 |3 |1970-01-01 01:00:00+01 |32 |08:00 |22:00 |
到目前为止,我只知道如何选择 json 查询的内容。例如,如果我运行
JSON_VALUE([openingtimes_json], '$.openingTimes[0}.applicable_days')
我的第一条记录是 63 分。