Careful with that technique - it can get ugly really fast...

Yeah, as previously mentioned theres the Celko Nested Set:

http://www.intelligententerprise.com/001020/celko.jhtml?_requestid=235427
http://www.codebits.com/ntm/

Not bad, though its rather volatile on update (if something goes awry 
during a record update - you're seriously screwed) , and indexing it is 
pretty much next to impossible because of the joins. But on the upside 
you can have pretty much infinite relationships based on two integer fields.

In fact - Celko has an entire book on this and other hierachy techniques:

http://www.codebits.com/ntm/

Theres also some interesting work being done on materialized paths and 
nested sets using some wacked out fractional calcs:

http://www.dbazine.com/oracle/or-articles/tropashko4
http://arxiv.org/html/cs.DB/0401014

Upside here is that indexes can be build a bit easier, and the insert & 
update functionality is lightning fast.. downside - large trees get 
kinda scary.

Hope all that helps. Cheers,

Erik Yowell
Short Fuse Media, Inc.
[EMAIL PROTECTED]


Bobby Hartsfield wrote:

>Thanks for the response.
>
>I guess I should have mentioned that it's MySQL. 
>
>I'm thinking that I could do something like...
>
>itemID
>ItemTitle
>ItemURL
>ItemParentID
>
>And parent ID would just point to another record in the same table if the
>item was indeed a sub item of another item. That items 'parent' could then
>also point to another item as its parent, etc...
>
>And maybe just a 0 for parentID when the item is 'top level'.
>
>I've used this before but I've always known exactly how deep the nests would
>go which in turn let me know exactly how many nested loops I would need to
>build everything
>
>..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
>Bobby Hartsfield
>http://acoderslife.com
>  
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221878
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to