As far as I know mysql does not support recursive query feature. if you are using PHP then instead of recursive query u can go for recursive function
function get_childs($parent)
{
$q="SELECT identity FROM entity WHERE identity= ANY (SELECT identity FROM entities_parent_child WHERE idparent=".$parent "'";
$query=mysql($q);
while ($row = mysql_fetch_array($query))
<div class="answerBody quoted" id="EchoTopic">
{
echo "<table><tr><td>-</td></tr>";
echo "<tr><td>entity name:".$row['name']."</td></tr>";
get_childs($row['identity']);
echo "</td></tr></table>";
}
}</div><div class="answerBody quoted" id="EchoTopic"> </div><div class="answerBody quoted" id="EchoTopic">hope this will help you
</div>
yrb.yogi
Star
14460 Points
2402 Posts
How to write Recursive query in mysql as provided in SQL server 2005
May 15, 2009 05:12 AM|LINK
Hellp frnds,
i have a table name "Category" in mysql database.
the table has field (CategoryId,Name,ParentId) in this table parent id refer to same table's primary key (categoryid)...
how can i write the recursive query to retrive the data with parent info.......
mysql
.Net All About
alankarp
Contributor
2042 Points
345 Posts
Re: How to write Recursive query in mysql as provided in SQL server 2005
May 15, 2009 11:03 AM|LINK
Hi,
Please have look on following link
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
This link may help you to find solution
Thanks
Profile
yrb.yogi
Star
14460 Points
2402 Posts
Re: How to write Recursive query in mysql as provided in SQL server 2005
May 15, 2009 11:42 AM|LINK
hello alankarp,
i have already seen that link's content.....
is there any other way to do this.....
i cant getting that link's content...thts y..............................................
mysql
.Net All About
alankarp
Contributor
2042 Points
345 Posts
Re: How to write Recursive query in mysql as provided in SQL server 2005
May 15, 2009 12:07 PM|LINK
As far as I know mysql does not support recursive query feature. if you are using PHP then instead of recursive query u can go for recursive function
function get_childs($parent)
<div class="answerBody quoted" id="EchoTopic">{
$q="SELECT identity FROM entity WHERE identity= ANY (SELECT identity FROM entities_parent_child WHERE idparent=".$parent "'";
$query=mysql($q);
while ($row = mysql_fetch_array($query))
{
echo "<table><tr><td>-</td></tr
echo "<tr><td>entity name:".$row['name']."</td>
get_childs($row['identity'
echo "</td></tr></table>";
}
}</div><div class="answerBody quoted" id="EchoTopic"> </div><div class="answerBody quoted" id="EchoTopic">hope this will help you
</div>
Profile
yrb.yogi
Star
14460 Points
2402 Posts
Re: How to write Recursive query in mysql as provided in SQL server 2005
May 15, 2009 12:13 PM|LINK
Sorry i m using C# asp.net....any help regarding this....
.Net All About
yrb.yogi
Star
14460 Points
2402 Posts
Re: How to write Recursive query in mysql as provided in SQL server 2005
Dec 04, 2012 06:05 AM|LINK
To Solve this issue, i have created one physical table & logic for recursive.
.Net All About