>Hello,
>at the time I try to figure out what's the best way
>to get a kind of parent/child - hierarchy with unlimited
>subchild.
>My special attention is situated on really fast SELECT statements.
>
>Actually I'm using nested sets like:
>
>CREATE TABLE Personnel
>(emp CHAR(10) PRIMARY KEY,
>salary DECIMAL(6,2) NOT NULL,
>left INTEGER NOT NULL,
>right INTEGER NOT NULL);
>
>so I fetch all the bosses of an employee with this kind of SELECT:
>
>SELECT :myworker, B1.emp, (right - left) AS height
>FROM Personnel AS B1, Personnel AS E1
>WHERE E1.left BETWEEN B1.left AND B1.right
>AND E1.right BETWEEN B1.left AND B1.right
>AND E1.emp = :myworker;
>
>
>but now I wonder if it wouldn't be better to use the
>so called "key path method" where you put the whole
>top hierarchy info of a node into one column like:
>root/parent1/parent23/parent40/... and so on.
>
>Did someone make experience with one of this methods?
>
>thanx
>chris

At risk of sounding like a broken record:
'SQL For Smarties' by Joe Celko, chapters 28 & 29.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

---------------------------------------------------------------------
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

Reply via email to