I have checked out some other questions, and I cant seem to find any that answer my specific question.
The following table is the result of this query:
SELECT teacher.teacherID, unitName FROM teacher INNER JOIN unit ON teacher.teacherID=unit.teacherID ORDER BY teacherID ASC

What I actually need the result to display is this:

Is there a way to modify my current query so that this can be achieved? I wasn't sure if this was possible in MySQL at all, but as I have learned in the past, you should never underestimate the power of a query! (this was discovered after spending time using messy nested loops trying to manipulate an array, instead i managed to do it all in a query)
EDIT: SQL Fiddle
Thanks, and I would appreciate any help!