![](/img/trans.png)
[英]Invalid JSON path expression. The error is around character position
[英]Invalid JSON path expression. The error is around character position 1
我有一個名為carts
的表,它具有以下結構:
1 crt_id Primary bigint(20)
2 crt_mbr_id bigint(20)
3 crt_session_id varchar(128)
4 crt_content text
5 crt_send_type int(11)
6 crt_completed tinyint(1)
7 created_at timestamp
8 updated_at timestamp
crt_content
數據是這樣的:
[{"id":"24","quantity":"1","price":3000,"discounted":3000,"coupon":0}]
現在我需要在crt_content
中搜索數字24
。
所以我嘗試了這個:
SELECT JSON_UNQUOTE(JSON_EXTRACT(crt_content, '24')) as scope from carts
但這會給我這個錯誤:
#3143 - Invalid JSON path expression. The error is around character position 1
那么這里出了什么問題? 如何在此carts
表的crt_content
字段中正確搜索24的id
?
您可以嘗試 LIKE 查詢, SELECT * from carts WHERE crt_content LIKE '%"id":"24"%';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.