i have something thats working,
but i get some data 2 or 3 times ...
select n2.id as id, n2.name as name,(COUNT(n1.id)-1) as depth, if( (n2.lft+1) = n2.rgt, 0, 1) as haskids,
GROUP_CONCAT(distinct n1.id order by n1.lft SEPARATOR '-') as pht, group_concat(d.status), group_concat(d.owner)
, group_concat(if ( i.block_id_1 = n2.id, i.block_id_2, i.block_id_1)) as top
FROM block AS n1
INNER JOIN block n2 ON n2.lft BETWEEN n1.lft AND n1.rgt
LEFT JOIN interaction AS i ON n2.id = i.block_id_1 OR n2.id = i.block_id_2
LEFT JOIN interaction_data AS d ON i.id = d.interaction_id
WHERE n2.lft BETWEEN (SELECT lft FROM block WHERE id = 1) AND (SELECT rgt FROM block WHERE id = 1) AND n2.build_id <= 1000 OR n2.build_id = 1000
GROUP BY n2.id ORDER BY n2.lft
the group_concats on all fields from the interaction_data table are seen 2,3 or 4 times any idea why?
EDIT: nevermind see my other post about group by