I have vacancies and departments and I want to get all departments with vacancies as json array. I try to use JSON_ARRAYAGG function but got mysql syntax error.
select vd.id, vd.title, vd.sort,
(select json_arrayagg(v.id, v.title) from vacancies as v where vd.id = v.department_id) as vacancies
from vacancy_departments as vd
near …part contains an important clue as to what may have caused the error. 2) Also, what's the exact version of your MySQL? This function was introduced in 5.7.22.