Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Operation on hierchical datas

9:18 am on Nov 18, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 6, 2006
votes: 0

Hello forums!
I would like to know the queries required to operate on hierarchical datas like INSERT, SELECT, UPDATE, DELETE etc. so that the action can be done with one query.
My hierarchical data are contained in the table as:
Thanks in advance for the suggestion.
7:44 pm on Nov 18, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 12, 2007
votes: 0

What do you mean
so that the action can be done with one query.
As you cant DELETE and INSERT with the same statement. You need one statement for INSERTing and another for DELETing, same with the other statements.

There are a list of the statements that are allowed by mysql here [dev.mysql.com]. I dont know if this is what you are looking for, but hopefully it will help.

6:43 am on Nov 20, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 31, 2007
votes: 0

Hi PHPycho,

Any particular reason you want to do it in one query (e.g. for ad-hoc stuff)? Is it for MySQL or some other DB? You can check out this article: [dev.mysql.com ]
or search for "recursive queries", or use stored procedures if your DB supports them.

You may also get better responses in the Databases forum, or the MySQL forums...