i think you would want to order by ParentID. set a var to iParentID = 0 then check for the queried ParentID if a new parent ID you would want to create a new branch on the tree set the iParentID = queried parentID. something like that.
>>> [EMAIL PROTECTED] 08/10/2005 7:39:35 AM >>> Wouldn't that just be "SELECT * FROM myTable ORDER BY [name]"? "Name" is a reserved word and should never be used as a field name (but if you absolutely have to, you can enclose it in brackets as shown above). Regards, Peter From: "Yusrizal Fahmi" [EMAIL PROTECTED] Team, Please help me on this following problem. for examples I have a data: Id name level parent --------------------------------------------------------------- 1 Director 1 0 2 Marketing 2 1 3 Sales 2 1 4 Marketing Staff1 3 2 5 Marketing Staff2 3 2 6 Sales Staff1 3 3 7 Sales Staff2 3 3 8 Sales Staff3 3 3 I want to make a sql syntax to produce result like: Id name level parent --------------------------------------------------------------- 1 Director 1 0 2 Marketing 2 1 4 Marketing Staff1 3 2 5 Marketing Staff2 3 2 3 Sales 2 1 6 Sales Staff1 3 3 7 Sales Staff2 3 3 8 Sales Staff3 3 3 Basically it's a tree data, but I don't have a clue how to make the result. Please help me. Thanks rizal [Non-text portions of this message have been removed] Yahoo! Groups Links [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h9amuo7/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123693627/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
