RE: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Arno Kuhl
If your data is based upon parentid and uniqueid, then you will need to change your data... http://data.bangtech.com/sql/nested_set_treeview.htm and once you've done that and find you can't deal with things (maybe it isn't for you), then http://pratchev.blogspot.com/2007/02/convert-tree-structure

Re: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Jim Giner
""Arno Kuhl"" wrote in message news:DB930522404B4552B8A15AF991C57E30@point01... > > Hi Jim. Only one linked list of parentids. No siblings. > Multiple records can have the same parentid, but that doesn't play a role. > Okay. So you want only one 'family tree' at any given time, and a tree is a

RE: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Arno Kuhl
> Hi Jim. I wanted the list of related parentids from current id to > top-level > (parentid=0). Ah - now that is a much different question! >From your statement above, are you now saying you only want ONE list of related ids, not the entire society of possible 'families' in your table? Als

Re: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Richard Quadling
On 28 July 2011 14:09, Arno Kuhl wrote: >> >> I have a table with an id and a parentid. >> If it's a top-level record the parentid is 0, otherwise it points to >> another record, and if that record isn't a top-level record its >> parentid points to another record, etc (a linked list). >> >> Is the

Re: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Jim Giner
""Arno Kuhl"" wrote in message news:D349CC15D13F48DD8D4F6ED70062138C@point01... > > > Hi Jim. I wanted the list of related parentids from current id to > top-level > (parentid=0). Ah - now that is a much different question! >From your statement above, are you now saying you only want ONE

RE: [PHP-DB] Re: Listing parent ids

2011-07-28 Thread Arno Kuhl
> > I have a table with an id and a parentid. > If it's a top-level record the parentid is 0, otherwise it points to > another record, and if that record isn't a top-level record its > parentid points to another record, etc (a linked list). > > Is there a single select that will return the comple

[PHP-DB] Re: Listing parent ids

2011-07-28 Thread Jim Giner
""Arno Kuhl"" wrote in message news:487F03135D2B452B89F22C95E278C7D4@point01... > > I have a table with an id and a parentid. > If it's a top-level record the parentid is 0, otherwise it points to > another > record, and if that record isn't a top-level record its parentid points to > another r

RE: [PHP-DB] Listing parent ids

2011-07-28 Thread Arno Kuhl
> I'm currently using MySQL but I'll switch databases if there's a > compelling reason and no drawbacks. > Thanks for the lead, I'm googling recursive queries. 'common table expression' is the thing to google for, but MSDN seem to have hijacked all the top spots. http://syntaxhelp.com/SQLServer/R

Re: [PHP-DB] Listing parent ids

2011-07-28 Thread Richard Quadling
On 28 July 2011 12:30, Arno Kuhl wrote: > On 28 July 2011 10:39, Arno Kuhl wrote: >> Arno Kuhl wrote: >>> Not strictly a php issue but it's for a php app, hope that counts >>> (plus I haven't had much joy googling this) >>> >>> I have a table with an id and a parentid. >>> If it's a top-level rec

RE: [PHP-DB] Listing parent ids

2011-07-28 Thread Arno Kuhl
On 28 July 2011 10:39, Arno Kuhl wrote: > Arno Kuhl wrote: >> Not strictly a php issue but it's for a php app, hope that counts >> (plus I haven't had much joy googling this) >> >> I have a table with an id and a parentid. >> If it's a top-level record the parentid is 0, otherwise it points to >

Re: [PHP-DB] Listing parent ids

2011-07-28 Thread Lester Caine
Arno Kuhl wrote: I'm currently using MySQL but I'll switch databases if there's a compelling reason and no drawbacks. Thanks for the lead, I'm googling recursive queries. 'common table expression' is the thing to google for, but MSDN seem to have hijacked all the top spots. http://syntaxhelp.c

Re: [PHP-DB] Listing parent ids

2011-07-28 Thread Richard Quadling
And http://www.amazon.co.uk/exec/obidos/ASIN/1558609202/onlinepricecouk -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Listing parent ids

2011-07-28 Thread Richard Quadling
On 28 July 2011 10:39, Arno Kuhl wrote: > Arno Kuhl wrote: >> Not strictly a php issue but it's for a php app, hope that counts >> (plus I haven't had much joy googling this) >> >> I have a table with an id and a parentid. >> If it's a top-level record the parentid is 0, otherwise it points to >>

RE: [PHP-DB] Listing parent ids

2011-07-28 Thread Arno Kuhl
Arno Kuhl wrote: > Not strictly a php issue but it's for a php app, hope that counts > (plus I haven't had much joy googling this) > > I have a table with an id and a parentid. > If it's a top-level record the parentid is 0, otherwise it points to > another record, and if that record isn't a top-

[PHP-DB] Listing parent ids

2011-07-28 Thread Arno Kuhl
Not strictly a php issue but it's for a php app, hope that counts (plus I haven't had much joy googling this) I have a table with an id and a parentid. If it's a top-level record the parentid is 0, otherwise it points to another record, and if that record isn't a top-level record its parentid po