MySQL Forums
Forum List  »  Quality Assurance

How to swap two rows in mysql Hierarchical Data table
Posted by: praveen jalakam
Date: April 06, 2011 10:30PM

Hi,

I created mysql hierarchical data table,
CREATE TABLE treeviewdata(entityid INT AUTO_INCREMENT PRIMARY KEY,nameVARCHAR(20) NOT NULL,parentid INT DEFAULT NULL);

Mysql>Select * from treeviewdata;

+-----------------------------------------+
| entityid | name | parentid |
+-----------------------------------------+
| 1 | ELECTRONICS| NULL |
+-----------------------------------------+
| 2 | TELEVISIONS| 1 |
+-----------------------------------------+
| 3 | TUBE | 2 |
+-----------------------------------------+
| 4 | LCD| | 2 |
+-----------------------------------------+

Now i want to swap rows in treeviewdata table where parentid=2;



Edited 1 time(s). Last edit at 04/13/2011 12:17AM by praveen jalakam.

Options: ReplyQuote


Subject
Views
Written By
Posted
How to swap two rows in mysql Hierarchical Data table
2416
April 06, 2011 10:30PM


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.