簡體   English   中英

JSON 路徑表達式無效。 錯誤是圍繞字符 position 1

[英]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字段中正確搜索24id

您可以嘗試 LIKE 查詢, SELECT * from carts WHERE crt_content LIKE '%"id":"24"%';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM