ds3016 2016-06-14 10:04 采纳率: 100%
浏览 396
已采纳

如何使用在名称之间有空格的键在mysql中为Json创建where查询

With json as

{ "First Name": {"nickname" : "Abc"} }

in json column 'name' of mysql database.

How do I extract such rows in mysql.

Select * from users where name."$.First Name.nickname" = "abc";

won't work. Any solution because I cannot change the json structure in database.

  • 写回答

2条回答 默认 最新

  • duanbairan4235 2016-06-14 10:47
    关注

    Found the answer:

    Select * from users where name."$.""First Name"".nickname" = "abc";
    

    you need to double quote the key of JSON with a space.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?