The result of a field is a JSON format such as
["12312", "I am Me", 0]
I would like to sort by the value of 12312, can I ask you to achieve it?
Reply content:
The result of a field is a JSON format such as
["12312", "I am Me", 0]
I would like to sort by the value of 12312, can I ask you to achieve it?
If your application is relatively simple and the amount of data is not very large, my advice is to take out the fields that need to be sorted as an indexed field. That is
"12312" | ["12312", "I am Me", 0]
If you think that your application scenario will become more complex, or the amount of data that needs to be indexed is very large, then consider MongoDB and directly deserialize the data into each field, that is
"12312" | "I Am Me" | 0
Use NoSQL or be cautious ... Can be done with MySQL, try to use MySQL
First, MySQL does not support Bson or JSON, even after the storage JSON is serialized. So the sort words have to be realized by themselves. This is not a good implementation, either from the MySQL side or from the script side, because a deserialization operation is required.
Second, you're storing like a document database (a NoSQL one), and MySQL is a relational database, so it's best to have a table and then move the data out of the way. Or use a document-based database such as MongoDB.
Reference @gaosboy
If you have a small amount of data and simply implement this function (without regard to efficiency)
Order BY cast (mid (fname, 3) as unsigned)