W
W
WQP2017-01-10 20:54:38
MySQL
WQP, 2017-01-10 20:54:38

How to link two fields in a database?

Hello, there is a table boxin it there is a field itemsin the format jsonstructure like this

[
  {
    "id": 1,
    "params" : []
  },
  {
    "id": 2,
    "params" : []
  }
]

How can I get elements from another table using id?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2017-01-10
@Sanasol

If you don't have an older version of mysql. Very old because json is very recent.
It will probably turn out https://dev.mysql.com/doc/refman/5.7/en/json-searc...
But there you need to specify the exact paths to the variables.
As far as I can see, walking through the array and comparing each element will not work.
There is also no support for in() and some other functions.

T
ThunderCat, 2017-01-10
@ThunderCat

Is it just to try it out or do you want to be so perverted in production?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question