• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 992
  • Last Modified:

How to get all child nodes from a parent node

I want the parent node,child node,grand child node,grand child node, etc....


SELECT `LeftN`, `RightN` FROM amount WHERE `LeftN`= 'AMSXATUMI' OR `RightN`='AMSXATUMI' OR `SId`= 'AMSXATUMI' OR `SId` IN (SELECT `LeftN` FROM amount WHERE `SId` = 'AMSXATUMI') OR `SId` IN (SELECT `RightN` FROM amount WHERE `SId` = 'AMSXATUMI')

I am using this query. But i got some nodes only like


      LeftN      RightN
                  AMSXATUMI       
                         AMSKEGUSU
                  AMSHUZEDU      AMSWIWEDE

But it should get datas like below:

 AMSKEGUSU------- AMSHUZEDU  AMSWIWEDE
AMSHUZEDU----- AMSGAFOVU AMSBUCEVO
AMSWIWEDE-------AMSLUHERE   AMSDENIBA

AMSGAFOVU------AMSNUFEBE  AMSVASETE
AMSBUCEVO------AMSBOHOKA  AMSJIPEBA

AMSLUHERE------ etc
AMSDENIBA------ etc

AMSNUFEBE------ etc
etc---- etc
and etc....

Example:

When i select(AMSXATUMI)  this id ,i want like this:

SId

AMSKEGUSU
AMSHUZEDU
AMSWIWEDE
AMSGAFOVU
AMSBUCEVO
AMSLUHERE
AMSDENIBA
AMSNUFEBE
AMSVASETE
AMSBOHOKA
AMSJIPEBA.....

and etc.....


I want to display all child links from one parent node
amount.sql
0
jnj_web_solutions
Asked:
jnj_web_solutions
1 Solution
 
virmaiorCommented:
the table structure is not sufficiently clear to me to answer your question...
0
 
Vee_ModCommented:
I've requested that this question be deleted for the following reason:

jnj_web_solutions,<br /><br />Welcome to EE - we are glad that you joined us.<br />&nbsp;<br />Please review the information at the links below for methods of managing your own question:<br />Asking: <a href="http://www.experts-exchange.com/help/viewHelpCategory.jsp?helpCategoryID=3">http://www.experts-exchang<wbr />e.com/help<wbr />/viewHelpC<wbr />ategory.js<wbr />p?<wbr />helpCate<wbr />goryID=3</a><br />Closing: <a href="http://www.experts-exchange.com/help/viewHelpPage.jsp?helpPageID=24">http://www.experts-exchang<wbr />e.com/help<wbr />/viewHelpP<wbr />age.jsp?<wbr />he<wbr />lpPageID=2<wbr />4</a><br />Deleting: <a href="http://www.experts-exchange.com/help/viewHelpPage.jsp?helpPageID=25">http://www.experts-exchang<wbr />e.com/help<wbr />/viewHelpP<wbr />age.jsp?<wbr />he<wbr />lpPageID=2<wbr />5</a><br /><br />You should never &quot;Accept&quot; a comment as a solution unless it is one. I have re-opened this question and will start the auto-delete process.<br /><br />Also, I see that you have asked this question 3 times now. Please only ask the same question once, then respond to the experts trying to help you in that one question.<br />&nbsp;<br />Vee_Mod<br />Experts-Exchange Moderator<br />
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now