Is it possible to shift column data downwards in a MySQL table? -
I want to use a table like this:
+ ---- - + ------------ + ----------- + | ID | Col1 | Col2 | + ------ + ------------ + ----------- + | 1 | ABC | Amano | + ------ + ------------ + ----------- + | 2 | Def | Pqr | + ------ + ------------ + ----------- + | 3 | Too. Stu | + ------ + ------------ + ----------- +
What is a way to add A new line and a column downwards change? The table should look like this ...
+ ------ + ------------ + ----------- + | ID | Col1 | Col2 | + ------ + ------------ + ----------- + | 1 | ABC | | + ------ + ------------ + ----------- + | 2 | Def | Amano | + ------ + ------------ + ----------- + | 3 | Too. Pqr | + ------ + ------------ + ----------- + | 4 | JKL Stu | + ------ + ------------ + ----------- +
New line with cell price Put [Row 4, call1] = 'JKL', but I want to increase call 2 data downwards, so [line1, cola 2] is now zero.
Thanks in advance.
EDIT: Thanks RAD & amp; 2unco; There was a play and you can find many columns in the same statement ...
update mytable t1 left oUTER mytable T2 ON T1.id = T2.id + 1 SET t1.col2 = T 2 CO 2, T1COL3 = T2COL3;
update table 1 T1 Join Table 1 on T2 Ti. TID = T.2ID + 1 SET T1COL2 = T2Co2; Set Table 1 col2 = NULL where id = 1;
Edit: In a statement
update table 1 T1 left T1.id = T2.id + 1 SET T1.col2 = T2 table Join 1 T2. Cola2;
Comments
Post a Comment