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)

5+ Year Member

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)

WebmasterWorld Senior Member 5+ Year Member

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)

5+ Year Member

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...


Featured Threads

Hot Threads This Week

Hot Threads This Month