Coming from here sql group_concat and subquery
I managed to "solve" de problem by doing this a "subquery":
SELECT
GROUP_CONCAT(name,',',results separator '#')
as finalresult
FROM
(
select t.name as name, group_concat(distinct r.idResult separator '-') as results
from threshold t
left join threshold_results r on r.idThreshold = t.idThreshold
group by t.idThreshold, t.name
) final
But it is too slow when there are many records, withouth the subquery the initial solution performs very well. Any ideas?
Thank you!