【发布时间】:2023-03-23 15:32:01
【问题描述】:
我有一个事务表,它有一个名为“request”的 json 类型字段。
| Field | Type | Null | Key | Default |
| id | bigint | NO | PRI | NULL |
| request | json | NO | | NULL |
| response | json | YES | | NULL |
request 有两个属性 currencyCode 和 amount。
{"amount":100000,"currencyCode":"PHP"}
我可以使用以下 mysql 查询来获取这些值
select json_extract(request, "$.amount") as amount, json_extract(request, "$.currencyCode") as currency from transaction;
| amount | currency |
+--------+----------+
| 100000 | PHP |
| 100000 | PHP |
| 100000 | PHP |
我想使用类似这样的 jooq 查询来获取这些值。
DSL.select(<Tables.TRANSACTION.REQUEST.amount>, <Tables.TRANSACTION.REQUEST.currencyCode>)
.from(Tables.TRANSACTION)
.fetch()
如果有人可以帮助我,我真的很感激。
【问题讨论】: