RE: *** Complicated SQL riddle

2001-10-30 Thread Jeremy Allen
ailto:[EMAIL PROTECTED]] Sent: Tuesday, October 30, 2001 8:13 AM To: CF-Talk Subject: RE: *** Complicated SQL riddle Am going to try to pick up a copy of Celko's book. Not sure how, but I think I have something that works: Had to include a column in the table called level, which then

Re: *** Complicated SQL riddle

2001-10-30 Thread Deanna Schneider
Good point. We're still using 4.5. Unlucky us. -d Deanna Schneider Interactive Media Developer [EMAIL PROTECTED] ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusio

RE: *** Complicated SQL riddle

2001-10-30 Thread Jason Blum
! -J > -- > From: Deanna Schneider > Reply To: [EMAIL PROTECTED] > Sent: Tuesday, October 30, 2001 9:06 AM > To: CF-Talk > Subject: Re: *** Complicated SQL riddle > > Jason, > It looks like you're using Oracle, and if so, you don't need t

Re: *** Complicated SQL riddle

2001-10-30 Thread Deanna Schneider
Jason, It looks like you're using Oracle, and if so, you don't need to have a "level" column in the table, as level is a psuedo-column available to you when you use connect by...prior. However, you'll discover that using connect by...prior only works if your data in the table is already correctly

Re: *** Complicated SQL riddle

2001-10-30 Thread Deanna Schneider
Anyone care to work on porting these stored procedures to Oracle? I'm willing to work on it, but would love some help. -Deanna Deanna Schneider Interactive Media Developer [EMAIL PROTECTED] ~~ Get the mailserver that powers this list at http://

RE: *** Complicated SQL riddle

2001-10-30 Thread Jason Blum
29, 2001 3:51 PM > To: CF-Talk > Subject: RE: *** Complicated SQL riddle > > Actually, > > One person did the hard work so we don't have to :) > > http://www.codebits.com/ntm/ > > Also check here: > > http://www.intelligententerprise.com/001020/celko.sht

Re: *** Complicated SQL riddle

2001-10-30 Thread Stephen Moretti
Jason, NTM is the better method, but if you're looking for a quick and dirty solution then write yourself a recursive tag. Just be careful not to get stuck in a loop and bring your server down tho. ;o) What you do is write a tag that you can pass a parent ID to. In the tag you : 1) do a que

RE: *** Complicated SQL riddle

2001-10-29 Thread Jeremy Allen
ctober 29, 2001 3:28 PM To: CF-Talk Subject: Re: *** Complicated SQL riddle Hey Jeremy, While pulling data out of the nested set model is easy, getting it in is not so easy. Care to throw out some examples of that? -D Deanna Schneider Interactive Media Developer [

Re: *** Complicated SQL riddle

2001-10-29 Thread Deanna Schneider
Hey Jeremy, While pulling data out of the nested set model is easy, getting it in is not so easy. Care to throw out some examples of that? -D Deanna Schneider Interactive Media Developer [EMAIL PROTECTED] ~~ Your ad could be here. Monies from a

RE: *** Complicated SQL riddle

2001-10-29 Thread Jeremy Allen
SQL trick its probably in there. Thanks Jeremy Allen elliptIQ Inc. -Original Message- From: Rick Osborne [Mojo] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 12:55 PM To: CF-Talk Subject: RE: *** Complicated SQL riddle Jason asked: >That's the problem - I need to

RE: *** Complicated SQL riddle

2001-10-29 Thread Rick Osborne [Mojo]
Jason asked: >That's the problem - I need to keep it flexible to accommodate any >number of levels because I want to output a tree illustrating the >hierarchy: >I think I've heard someone talking about "self-joins" but am not sure >how they'd work and whether they'd be flexible enough - anyone h

RE: *** Complicated SQL riddle

2001-10-29 Thread Andy Ewings
One way is to write an SP and in it you create a temp table (#temp in this example) with one field called ID then.. -- Insert initial records INSERT INTO #Temp (ID) SELECT ID FROM table WHERE Boss = @ID --Insert all terms further down the heirarchy DECLARE @rowcount int , @rowcount1 in

Re: *** Complicated SQL riddle

2001-10-29 Thread Richard Ramos
Jason, You've got the right idea, but I would recommend you make John's boss be 0, since he would be the top of the chain. Then all you have to do is make your query and group by ID and Boss. You can easily show all the data using cfoutput or you can use cftree. Richard - Original Message

RE: *** Complicated SQL riddle

2001-10-29 Thread Jeremy Allen
Hi, What you are trying to do is a very common situation. The Child-Parent model is a workable solution. You might really want to take a look at the Nested Set Model (or NTM, Nested Tree Model). The NTM model uses a different approach to establishing hierarchies. Check out Dave Medinets stored