I have a table tasks and another table master_employee
i am trying to list some task details alongside with a String that is going to be parsed as a json object
SELECT task_name,assignees,priority,
DATE_FORMAT(due_date, "%M %d %Y") as due_date ,
(select GROUP_CONCAT(CONCAT('{ id:"',emp_id, '",name:"',first_name ,'"}')) as list
from master_employee where emp_id in(2925,2913)) as list
FROM tasks
where task_id=4189
The String that i was referring to is the is the column alias 'list' . so the problem is ,as we know subqueries does not return multiple values , the query returns the concatenated values of only one emp_id . i want ,for example in this case concatenated values of emp_id's 2925 and 2913
Probably you are using GROUP_CONCAT function without the GROUP BY clause. if you don't have suitable field for group then just use group by with anything for example 1 or '1'