homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Operation on hierchical datas
PHPycho




msg:3507962
 9:18 am on Nov 18, 2007 (gmt 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:
¦id¦title¦parent_id¦description¦
Thanks in advance for the suggestion.

 

PHP_Chimp




msg:3508215
 7:44 pm on Nov 18, 2007 (gmt 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.

borntobeweb




msg:3509516
 6:43 am on Nov 20, 2007 (gmt 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...

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved