本文介绍了使用mysql在json对象中搜索字符串值对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的数据库表字段中有一个 json 对象,如下所示:
I have a json object in my database table field like following :
[{"user_id":"xyz","viewed":"false","answered":"false","denied":"false"}]
.其他字段是 id、q_id 和 stuff.
[{"user_id":"xyz","viewed":"false","answered":"false","denied":"false"}]
.the other fields are id, q_id and stuff.
我想在表中搜索用户 xyz!我如何使用 mysql 来做到这一点?
I want to search for the user xyz in the table!how can i do that using mysql?
推荐答案
感谢您的回答.但我只是使用了一个类似的查询,它起作用了
thank you for your answers. But i just used a like query and it worked
SELECT viewers from tablename where viewers like '%\"user_id\":\"xyz\"%' && qid= 1;
这篇关于使用mysql在json对象中搜索字符串值对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!