A
A
Alex Mirgorodskiy2018-04-06 10:13:11
MySQL
Alex Mirgorodskiy, 2018-04-06 10:13:11

Is it possible to form a query so that the string contains an array?

Hello everyone, I came across such a task, you need to return an array of questions, and in each question an array with 5 answer options for it, the link by id is the question, question_id is the answer to it. These are two different tables, hence the question, Is it possible to assemble a query so that in the line of the array of questions there is a line with an array of its answers (maybe json can be stuffed there somehow with a subquery, or something else). Because for now I manage by reassembling the desired array with my own hands from the selected two, questions and answers, and still I drive back and forth in json, if I manage to get the desired array in one request, then 2 pages of code can be avoided ... do not tell me this possible at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2018-04-06
@AlexWeb6667

GROUP_CONCAT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question