View Single Post
  #2 (permalink)  
Old 03-02-10, 14:50
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by Spudhead View Post
Is there a way to write an infinitely scaling version of this?
nope

what you could to is be practical and write as many LEFT OUTER JOINs as there are levels in your actual data

there are never an "infinite" number, there is always some maximum number of levels, and i have seen tests where 15 joins are handled efficiently, so don't worry about that part of it

as for sorting, you don't actually have to put the subtasks and subsubtasks on the same line with their parents, you can show one task per line, but you do need the joins in order to achieve the proper sorting

give me some sample data for three levels and i'll show you how
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote