Forum Moderators: open
so that the action can be done with one query.?
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.
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...