Id
The name
Award
Field of award saved josn string, content is:
[{" awardYear ":" 2014 ", "awardMonth" : "11", "awardDay" : "0"}, {" awardYear ":" 2013 ", "awardMonth" : "1", "awardDay" : "0"}, {" awardYear ":" 2012 ", "awardMonth" : "8" and "awardDay" : "0"}]
Or like this:
[{" awardYear ":" 2014 ", "awardMonth" : "11", "awardDay" : "0"}, {" awardYear ":" 2000 ", "awardMonth" : "6", "awardDay" : "0"}, {" awardYear ":" 1982 ", "awardMonth" : "3", "awardDay" : "0"}, {" awardYear ":" 1980 ", "awardMonth" : "7", "awardDay" : "0"}]
Now want to write an SQL statement, query out all awardYear in this field is less than or equal to 2013 data,
Consult! thank you
CodePudding user response:
If you use is a relational database, use the corresponding query methods,If you are using Mysql, Mysql version should be above 5.6.8, it can support the Json data, query similar
Select * from table where json_extract (award, '$. AwardYear) & lt; '2013'
Specific method of use, also need you to look up the corresponding version of the corresponding document
CodePudding user response:
Thank you, my mysql version is also 5.4.7, it seems to be a upgrade, thank you very much!