The very first thing I would do is change this:

JOIN ClassTree
     ON Parent_ID = ClassTree.ID 


to this:

JOIN ClassTree                         
     ON t.Parent_ID = ClassTree.ID 


It might be trying to join ClassTree to itself since you didn't specify the table alias in the join.

CTE Running in Infinite Loop
Will the event horizons of a two black holes be perturbed or bent before a collision? What will the shape of the event horizon appear to be immediately after first contact?
