Surveys table: enter image description here
Questions table: enter image description here
My sql query:
SELECT s.id, q.question FROM questions q JOIN surveys s ON q.surveyId = s.id;
My results:
[
{
"id": 5,
"question": "Which industry are you working at?"
},
{
"id": 5,
"question": "What is your company's highest annual revenue?"
},
{
"id": 5,
"question": "How long has your company been operated? updated"
}
]
But I want this output:
[
{
"id": 5,
"questions": [
"Which industry are you working at?",
"What is your company's highest annual revenue?",
"How long has your company been operated?"
]
}
]