Hi.
Maybe I am missing something, but won't
SELECT M1.*,M2.*
FROM Menu AS M1
JOIN Menu AS M2 ON M1.ID = M2.ParentID
WHERE ID=0
ORDER BY M1.Index, M2.Index
work?
Bye,
Benjamin.
On Tue, Nov 20, 2001 at 06:04:11PM -0800, [EMAIL PROTECTED] wrote:
> I am trying to display a hierarchically related list of folders via a
> recursive SQL statement (each row in a table represents a folder).
> What is needed is a select that will sort the folders and associate
> the parent folder with their child, sub-folders. The kicker is that
> the items in the folder need to be maintained in a specific order. An
> exanple:
>
> A] Mailbox
> 1) Folder A
> a - A sent
> b - A store
> c - A hold
[...]
> Anyone have insight on how this may be accomplished?
>
> Here is one attempt at it but no luck so far:
>
> SELECT M1.*,M2.* FROM Menu AS M1 JOIN Menu AS M2 ON M1.ID =
> M2.ParentID WHERE ID=0;
>
> Full table definition dump below:
>
> CREATE TABLE Menu (
> ID smallint(6) NOT NULL auto_increment,
> Index tinyint(4) NOT NULL default '0',
> ParentID smallint(6) NOT NULL default '0',
> FolderName varchar(32) default NULL,
> Level smallint(6) NOT NULL default '1',
> PRIMARY KEY (ID)
> );
>
> Index is the order in which an item appears within a folder. Level is
> the level at which the folder is located, this makes it easier to
> indent the items in a folder.
[...]
--
[EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php