Is there a way in SQL to create a categorized listing from a table with
three fields like such:

TABLE FIELDS:
id  parent_id  name
---------------------------
1   NULL       Main Cat
2   1          Sub Cat
3   1          Sub Cat
4   3          Sub-Sub Cat
5   NULL       Main Cat
6   2          Sub-Sub Cat
7   3          Sub-Sub Cat
8   5          Sub Cat
9   5          Sub Cat
10  2          Sub-Sub Cat
11  6          Sub-Sub-Sub Cat
12  9          Sub-Sub Cat
13  7          Sub-Sub-Sub Cat

LISTING:
---------------------------
Main Cat (1)
- Sub Cat (2)
-- Sub-Sub Cat (6)
--- Sub-Sub-Sub Cat (11)
-- Sub-Sub Cat (10)
- Sub Cat (3)
-- Sub-Sub Cat (4)
-- Sub-Sub Cat (7)
--- Sub-Sub-Sub Cat (13)
Main Cat (5)
- Sub Cat (8)
- Sub Cat (9)
-- Sub-Sub Cat (12)

I hope this makes sense.

Scott Anderson
President/Webmaster
http://www.weekendclimber.com
[EMAIL PROTECTED]
--------------------------------------------
@_=map{[$!++,$_^$/]}split$�,"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
$|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
$�]<$_[$_-$*][$�];print+map{$_->[$|]}@_;select$�,$�,$�,0.1}}print$/

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to