As Mike said, MySQL does not support recursive selection or recursion functions.
If you have a maximum logical limit for your task concatenation (e.g. 5), you can use hard-coded self-connections.
SELECT t1.taskid as taskid1, t2.taskid as taskid2, t3.taskid as taskid3, t4.taskid as taskid4, t5.taskid as taskid5 FROM task t1 LEFT JOIN task t2 ON t2.parenttaskid = t1.taskid LEFT JOIN task t3 ON t3.parenttaskid = t2.taskid LEFT JOIN task t4 ON t4.parenttaskid = t3.taskid LEFT JOIN task t5 ON t5.parenttaskid = t4.taskid
What will give this result: http://sqlfiddle.com/#!2/c9f80/1/0
By the way, you have some self-regulatory tasks in your input that will create an infinity loop with recursion.
source share