Listing parent ids

From: Date: Wed, 27 Jul 2011 16:03:51 +0000
Subject: Listing parent ids
Groups: php.db 
Request: Send a blank email to php-db+get-47931@lists.php.net to get a copy of this message
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 points to another record, etc (a linked list). Is there a single select that will return the complete list of parentids? Or do I have to iterate selecting each parent record while parentid > 0 and build the list entry by entry? TIA Cheers, Arno

« previous php.db (#47931) next »