Problem with column

A

Anonymous

Guest
Hi All,

Here is my table:

mysql> select * from moroaming;
+----------+--------------+---------+--------+---------------------+---------------------+------------+
| RecordID | MobileNumber | Message | Status | DateInsert | DateSend | MONumber |
+----------+--------------+---------+--------+---------------------+---------------------+------------+
| 1 | 23276 | on | 1 | 2005-10-11 10:42:58 | 2005-10-11 10:42:58 | 0193366789 |
| 2 | 23276 | off | 1 | 2005-10-14 15:38:02 | 2005-10-14 15:38:02 | 0193366789 |
| 3 | USSD | IR ON | 1 | 2005-10-17 11:18:46 | 2005-10-17 11:18:46 | 0192026430 |
| 4 | USSD | IR OFF | 1 | 2005-10-17 11:30:10 | 2005-10-17 11:30:10 | 0192026430 |
| 5 | USSD | IR OFF | 1 | 2005-10-17 11:47:40 | 2005-10-17 11:47:40 | 0198761010 |
| 6 | USSD | IR OFF | 1 | 2005-10-17 11:47:40 | 2005-10-17 11:47:40 | 0193600005 |
| 7 | USSD | IR OFF | 1 | 2005-10-17 11:49:05 | 2005-10-17 11:49:05 | 0198761010 |
| 8 | USSD | IR ON | 1 | 2005-10-17 11:52:47 | 2005-10-17 11:52:47 | 0193600005 |
| 9 | USSD | IR ON | 1 | 2005-10-17 11:52:48 | 2005-10-17 11:52:48 | 0198761010 |
+----------+--------------+---------+--------+---------------------+---------------------+------------+


the problem is, the data inside MobileNumber column should be in the column of MONumber and vice versa...since this is live application, so i need to be careful with the data...i dunno how to replace the data in MobileNumber column with data in MONumber column and vice versa..if possible, i want to replace all the data using 1 query instead of replacing it one by one... hope anyone can help me in solving this data...


thanks in advance
 
Hi

Please go through the following steps.

1. Add another column to your table.
2. Move all the content of mobilenumber to this column
3. Move all the content of MOnumber to mobilenumber
4. move all the cotent of newly created column to MOnumber

Also dont forgot to take the backup before doing the above actions.
 
Back
Top