I have a table named carts
which has this structure:
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
And crt_content
data goes like this:
[{"id":"24","quantity":"1","price":3000,"discounted":3000,"coupon":0}]
Now I need to search in crt_content
for the number 24
.
So I tried this:
SELECT JSON_UNQUOTE(JSON_EXTRACT(crt_content, '24')) as scope from carts
But this will give me this error:
#3143 - Invalid JSON path expression. The error is around character position 1
So what's going wrong here? How can I search properly for id
of 24 in crt_content
field of this carts
table?