MySQL Forums
Forum List  »  Other Migration

Re: Create view with MySQL 4.1.20
Posted by: tanja
Date: July 21, 2004 12:06AM

Hello Nick,
it is so. I have a table, where I look for the depth of the dependency between e.g. child_id and parent_id.

child_id parent_id
----------------------
1 0
2 0
3 1
4 3
.....

So here is the depth 3.

I can do this with recursive query by view.
For example:
with recursive ChildInDirect (child_id ) as
(select child_id
from mytable
where parent_id = 0
union
select mytable.child_id
from childIdDirect, mytable
where mytable.parent_id = ChildInDirect.child_id)

It is my view with recursive query, and this query runs so long, untill I don't have anymore dependencies.
then I can do

select count(child_id)
fromChildInDirect;

Therefore I asked, how I can use view with MySQL.
Thank you!
Tanja


Options: ReplyQuote


Subject
Views
Written By
Posted
16408
July 20, 2004 04:18AM
8765
July 20, 2004 11:05AM
Re: Create view with MySQL 4.1.20
7696
July 21, 2004 12:06AM
9390
July 21, 2004 03:12AM
5945
July 22, 2004 02:59AM
5414
July 22, 2004 05:22AM
6900
July 22, 2004 05:42AM
5561
July 22, 2004 06:16AM
6025
July 22, 2004 07:14AM
5650
July 22, 2004 08:03AM
4325
April 22, 2009 02:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.